#include<stdio.h>
#include<conio.h>
#include<string.h>
char vowels(char *p);
void main()
{
char str[20];
clrscr();
printf(" \n \n Enter the string: \t ");
gets(str);
vowels(str);
getch();
}
char vowels(char *p)
{
int i,l;
l = strlen(p);
printf(" \n \n The vowels in the string are: \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')
{
printf("%c",p[i]);
}
else
continue;
}
return 1;
}
OUTPUT:
Enter the string: Malayalam
The vowels in the string are: a a a
ALSO READ:
Sample C Program To Swap Two Strings Using strcpy() Function.
Sample C Program To Sort A Given Number Of Strings Using strcmp() Function.
Sample C Program To Display Array Of Strings.
Sample C Program To Convert String To An Integer Using atoi() Function.
Sample C Program To Find The Length Of A 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