#include<stdio.h>
#include<string.h>
void main()
{
char str[20];
char *p;
int count=0;
clrscr();
printf("Enter the Line:");
gets(str);
p=str;
while(*p!='\0')
{
if(*p=='')
{
count++;
}
p++;
}
printf("The number of Word is: %d",count+1);
getch();
}
Output:Enter the Line: C Programming Language
The number of Word is: 3
#include<string.h>
void main()
{
char str[20];
char *p;
int count=0;
clrscr();
printf("Enter the Line:");
gets(str);
p=str;
while(*p!='\0')
{
if(*p=='')
{
count++;
}
p++;
}
printf("The number of Word is: %d",count+1);
getch();
}
Output:Enter the Line: C Programming Language
The number of Word is: 3
No comments:
Post a Comment