#include<stdio.h>
void strcount(char []);
void main()
{
char str[50];
char c;
while(1)
{
printf("enter string\n");
//gets(str);
scanf("%s",str);
strcount(str);
printf("want to run again? press y/n \n");
scanf("%s",&c);
if(c == 'n' || c == 'N')
break;
}
}
void strcount(char str[50])
{
int i,j=0;
for (i=0;str[i]!=NULL;i++)
{
if( str[i]=='a'||str[i]=='A'||str[i]=='e'||str[i]=='E'||str[i]=='i'||str[i]=='I'||str[i]=='o'||str[i]=='O'||str[i]=='u'||str[i]=='U')
j++;
}
printf("count of vowels in string is %d\n",j);
}
0 comments:
Post a Comment