Tuesday, 4 October 2011

Program 4 from term work FE


#include<stdio.h>
#include<conio.h>
#include<ctype.h>
void main()
{
char c[100];
int i,vowel=0, a=0;
clrscr();

printf("\n Ener a string : ");
gets(c);

for(i=0;c[i]!='\0';i++)
{
switch(tolower(c[i]))
{
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
vowel ++ ;
}
switch(tolower(c[i]))
{
case 'a' :  a++;
}
}

printf("\n\n You have entered : %s", c);
printf("\n\n number of charcters in given string : %d",i);
printf("\n\n Number of vowels in given string is : %d",vowel);
printf("\n\n Number of accurance of \'a'\ is : %d",a);
getch();
}

No comments:

Post a Comment