This program is used to check vowels(a, e, i, o, u) into string. It will check entire string character by character and count vowels into the string.
Source Code to check Vowels into String.
#include<stdio.h>
void main()
{
int i,count=0;
char str[50];
clrscr();
printf("\nEnter any string: ");
scanf("%s",&str);
for(i=0;str[i]!='\0';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' )
{
count++;
}
}
printf("\nVowels in string are : %d",count);
getch();
}

0 comments:
Post a Comment
Click to see the code!
To insert emoticon you must added at least one space before the code.