A program to read a line of text and print the number of vowels using function.
A program to read a line of text and print the number of vowels using function.
Codes
/*A program to read a line of text and print the number of vowels*/
/*Programed by Jitendra Kr Yadav
10116
22 Mar,2011*/
#include<stdio.h>
#include<conio.h>
void vowel(char strint[]);
main()
{
char string[20];
printf(“Enter any string: “);
gets(string);
vowel(string);
getch();
}
void vowel(char str[])
{
int i,count=0;
for(i=0;str[i]!=’\0′;i++)
if(str[i]==’a’||str[i]==’e’||str[i]==’i’||str[i]==’o’||str[i]==’u’)
count+=1;
printf(“The no of vowels are %d.\n\n”,count);
printf(“Press any key to continue…”);
}
Output
Enter any string: aeroplane
The no of vowels are 5.
Press any key to continue…