#include<stdio.h>
#include<conio.h>
#include<string.h>
char vowels(char *p);
void main()
{
char str[10];
clrscr();
printf(" \n \n Enter the string: \t ");
gets(str);
vowels(str);
getch();
}
char vowels(char *p)
{
int i,l,v=0;
l = strlen(p);
printf(" \n \n The number of vowels in the string is: \t ");
for(i = 0 ;i < l ; i++)
{
if ( p[i] == 'a' || p[i] == 'e' || p[i] == 'i' || p[i] == 'o' || p[i] == 'u' ||
p[i] == 'A' || p[i] == 'E' || p[i] == 'I' || p[i] == 'O' || p[i] == 'U' )
{
v++;
}
else
continue;
}
printf("%d",v);
return 1;
}
OUTPUT:
Enter the string: Dinosaur
The number of vowels in the string is: 4
ALSO READ:
Sample C Program To Accept A String & Display Vowels.
Sample C Program To Accept A String & Display In Reverse.
Sample C Program To Accept A String & Display Its Alternate Characters.
Sample C Program To Accept A String & Display Alternate Characters In Either Case.
Sample C Program To Accept A String & Display It's Substring.
Sample C Program To Accept A String & Display It's Alternate Characters In Reverse.
Sample C Program To Accept Two Strings & Display The Largest String.
Comments
Post a Comment
Please share your opinions and suggestions or your experience in the comments section. This way we can all help each other...
Experienced guys can share their resumes at admin@interview-made-easy.com