C programs on searching word in given array



#include < stdio.h >
#include< conio.h >
void main()
{
char ch;
int blank=1,character=0,line=1;
clrscr();
printf("Enter the string with blanks,tabs and new line\n");
printf("At the end put a full stop.\n");
while(ch!='.')
{
/* read a character from the standard input stream */
ch = getc(stdin);
if(ch==' ')
blank++;
else if(ch=='\n')
line++;
else if(ch!='.')
character++;
}
printf("\nWord %d\nCharacters %d\nLine %d",blank,character,line);
getch();
}




No comments:

Post a Comment