0
2.0kviews
Reading a series of words using scanf function

Subject : Structured Programming Approach

Title : Arrays, String, Structures and Union

Marks : 5M

2 Answers
0
207views
main() 
{ 
char word1[40],word2[40],word3[40],word4[40]; 
printf(“Enter text:\n”); 
scanf(“%s %s”,word1, word2); 
scanf(“%s”, word3); 
scanf(“%s”,word4); 
printf(“\n”); 
printf(“word1 = %s \n word2 = %s \n”,word1, word2); 
printf(“word3 = %s \n word4 = %s \n”,word3, word4); 
}
0
56views
main() 
{ 
char word1[40],word2[40],word3[40],word4[40]; 
printf(“Enter text:\n”); 
scanf(“%s %s”,word1, word2); 
scanf(“%s”, word3); 
scanf(“%s”,word4); 
printf(“\n”); 
printf(“word1 = %s \n word2 = %s \n”,word1, word2); 
printf(“word3 = %s \n word4 = %s \n”,word3, word4); 
}
Please log in to add an answer.