Check the number of vowels in the given string
Hello friends, here we are seeing the c program for the count the number of the vowel in the given string. We know a, e, i, o, u are five vowels. But how we check how many times the vowels have come in the sentence. So by using the following c program we easily count the number of vowels in the given string.
C language code for count the vowel:
#include<stdio.h>
#include<conio.h>
void
main()
{
int
c=0,count=0;
char
s[1000];
clrscr();
printf("Enter
the string:");
gets(s);
while(s[c]!='\0')
{
if(s[c]=='a' || s[c]=='A' || s[c]=='e'|| s[c]=='E' || s[c]=='i' ||
s[c]=='I' || s[c]=='o' || s[c]=='O' || s[c]=='u' || s[c]=='U')
count++;
c++;
}
printf("The no of vowels in the
given string is:%d\n",count);
getch();
}
______________________________________________
Output:
Enter the string: ccpptutoriallands_blogspot_com
The no of vowels in the given string is:8
Number of vowels
Reviewed by Amit Waghmare
on
August 11, 2019
Rating:
No comments: