143. Program to count vowels in a string
#include<stdio.h>
char ch[10],i;
int c=0;
void main()
{
printf("Enter a string : ");
scanf("%s",ch);
for(i=0;ch[i];i++)
{
if(ch[i]=='a' || ch[i]=='e' || ch[i]=='i' || ch[i]=='o' || ch[i]=='u')
{
c++;
}
}
printf("Total vowels in a string : %d",c);
}
Comments
Post a Comment