//Code:
#include
#include
#include
void main()
{
char ch[50];
int i,j,l;
clrscr();
printf("\n Enter any string : ");
gets(ch);
l=strlen(ch);
j=0;
for(i=0;i
if(ch[i]==' ')
j++;
printf("\n The no of words : %d",j+1);
getch();
}
/*Output:
Enter any string : my name is mostu mahalat
The no of words : 5
No comments:
Post a Comment