amarblog
Saturday, October 22, 2011
TO COUNT NUMBER OF WORDS IN A SENTENCE
#include
<stdio.h>
#include<conio.h>
#include<math.h>
#include<string.h>
int main ()
{char str1[100];
int i,x,c;
gets(str1);
c=0;
for(i=0;str1[i]!='\0';++i)
{
if(str1[i]==' ')
++c;
}
x=c+1;
printf("no of word is %d",x);
getch();
return 0;
}
1 comment:
zzzzz
August 25, 2016 at 11:27 PM
Nice program.. Here is a similar program
to count digits of a number
.
Reply
Delete
Replies
Reply
Add comment
Load more...
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Nice program.. Here is a similar program to count digits of a number.
ReplyDelete