#include<stdio.h>
#include<conio.h>
void main()
{
int wordcnt=0;
int charcnt=0;
char ch;
clrscr();
printf("Type a sentence: ");
while((getche()) != '\r')
{
charcnt++;
if(ch==' ')
wordcnt++;
}
printf("\nTotal characters are: %d",charcnt);
printf("\nTotal words are: %d",wordcnt+1);
getch();
}
#include<conio.h>
void main()
{
int wordcnt=0;
int charcnt=0;
char ch;
clrscr();
printf("Type a sentence: ");
while((getche()) != '\r')
{
charcnt++;
if(ch==' ')
wordcnt++;
}
printf("\nTotal characters are: %d",charcnt);
printf("\nTotal words are: %d",wordcnt+1);
getch();
}
0 comments:
Post a Comment