//counting number of vowels in a string
#include<stdio.h>
#include<string.h>
int vow(char);
int main()
{
int count=0,i;
char str[50];
printf("enter string");
gets(str);
#include<stdio.h>
#include<string.h>
int vow(char);
int main()
{
int count=0,i;
char str[50];
printf("enter string");
gets(str);
//below vow function is for checking the character is an vowel or not
for(i=0;str[i]!='\0';i++)
if(vow(str[i]))
count++;
printf("the no. of vowels in string is %d",count);
}
int vow(char c)
{
if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
return 1;
return 0;
}
if(vow(str[i]))
count++;
printf("the no. of vowels in string is %d",count);
}
int vow(char c)
{
if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
return 1;
return 0;
}
No comments:
Post a Comment