Skip to content

Instantly share code, notes, and snippets.

Created February 16, 2018 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/170a01ff2c1a7ee593ee0d345bbb2104 to your computer and use it in GitHub Desktop.
Save anonymous/170a01ff2c1a7ee593ee0d345bbb2104 to your computer and use it in GitHub Desktop.
programmingfaster
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
int i, wordcount=1;
char str[100];
printf("Enter a sentence:");
gets(str);
for(i=0;i<strlen(str);i++)
{
if(str[i]==32)
{
wordcount++;
}
}
printf("The number of words=%d",wordcount);
getch();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment