#include<stdio.h>
#include<string.h>
#include<ctype.h>
//#include<conio.h>
void main() {
char sen[100];
int i, count = 1;
//clrscr();
printf("Enter a Sentence : \n");
gets(sen);
for (i = 0; i < strlen(sen); i++) {
if (isspace(sen[i])) {
count++;
}
}
printf("Number of words in the sentence = %d", count);
printf("\n");
//getch();
}
Note: Remove the comment line when you are use Turbo C IDE for run your program.
Monday, 5 October 2015
Write a program to count total words in text.
Labels:
C,
GTU Practical
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment