Wednesday 30 January 2013

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 ();
}




Output
================

Enter any string: Hi

There are 1 vowels in it.

No comments:

Post a Comment

Comment