Problem èInput the words and check out the number of vowels, lines, non-vowels, spaces.

 

Answer è

/* wap to know the number of vowels, nonvowels, spaces, lines and so on.*/

#include <stdio.h>

main( )

{

int i,c,d,e,g;

char a,b,y;

b='a';

c=d=e=0;

g=1;

clrscr( );

printf ("\nenter the line.\nthis program will tell you the number of vowels.\n");

printf ("\nthis program will also tell you the line numbers\n(count one line on every newline created by prssing enter");

printf ("\nyou can terminate this program by giving double space followed by enter\n");

for (i=0; i<=1000; ++i)

{

scanf ("%c", &a);

if (a= ='\n')

g++;

if (a = = 'a' || a = = 'e' || a = = 'i' || a = = 'o' || a = = 'u')

c++;

else if (a= =' ')

d++;

else if (a!='a' || a!='e' || a!='i' || a!='o' || a!='u')

e++;

if (a= =' ' && b= =' ')

{

printf ("\n\t\t\tyou have terminated this program\n\n");

break;

}

b=a;

}

printf ("\nnumber of vowels are = %d", c);

printf ("\nnumber of spaces are = %d", d-2);

printf ("\nnumber of non-vowels are = %d", e);

printf ("\nnumber of lines = %d", g);

getch( );

return 0;

}