C program to read a series of words from a terminal using scanf function

				
					#include<stdio.h> 
#include<conio.h> 
void main()
{ 
char wrd1[40], wrd2[40], wrd3[40], wrd4[40]; 
printf(“enter text:”); 
scanf(“%s”, wrd1); 
scanf(“%s”, wrd2); 
scanf(“%s”, wrd3); 
scanf(“%s”, wrd4); 
printf(“\n”); 
printf(“word1=%s\nword2=%s\n”, wrd1, wrd2); 
printf(“word3=%s\nword4=%s\n”, wrd3, wrd4”); 
}
				
			
Output: 
Enter text: 

Seventh Street, India, rod 

Word1=seventh 

Word2=street 

Word3=India

Word4=rod

Leave a Reply