FINDING NUMBER OF WORDS IN A SENTENCE EXAMPLE 1
#include <stdio.h>
int main()
{
char st[128];
int i,nwords=0;
puts("enter a
sentence");
gets(st);
for(i=0;st[i]!=0;i++)
if(st[i]=='')
nwords++;
printf("numbers of words=%d",nwords+1);
return 0;
}
OUTPUT
Enter a sentence
Incredible india
Number of words =2
No comments:
Post a Comment