C program to count number of vowels in a string
#include<stdio.h> #include<conio.h> #include<string.h> void main() { char sk[10]; int count=0,i; clrscr(); printf("Enter a String :"); gets(sk); for(i=0;i<strlen(sk);i++) switch(sk[i]) { case 'A': case 'E': case 'I': case 'O': case 'U': case 'a': case 'e': case 'i': case 'o': case 'u': count++; break; } printf("Vowels are present in the string : %d", count); getch(); }
Output: