Tuesday, 28 August 2007

NUMBER OF VOWELS

WAP to count number of vowels

void main ()

{

char s[20],vw=0,i;

clrscr();

printf ("Enter any string: ");

gets (s);

for (i=0;i<=strlen(s);i++)

{

switch (s[i])

{

case 'a':

case 'e':

case 'i':

case 'o':

case 'u':

case 'A':

case 'E':

case 'I':

case 'O':

case 'U':

vw++;

}

}

printf ("There are %d vowels in it",vw);

getch ();

}

No comments:

Post a Comment