Learn C ProgrammingLearn ProgrammingPrograms On StringsResources

092. Write a program to count all vowels present in the string in C language

By September 18, 2012 September 5th, 2018 No Comments
#include<stdio.h>
#include<conio.h>  
main()
{
	int i,vowel=0;
	char *s;
	clrscr();
	printf("Enter the string 1....");
	scanf("%s",s);

	for(i=0;s[i]!='\0';i++)
	{
		if((s[i]=='A')||(s[i]=='E')||(s[i]=='O')||(s[i]=='U')||(s[i]=='I')||
		  (s[i]=='a')||(s[i]=='e')||(s[i]=='o')||(s[i]=='u')||(s[i]=='i'))
						vowel++;
	}
	printf("\nVowels : %d",vowel);
	getch();
}



Leave a Reply

DEMO01