Search This Blog

Translate

c program to count the number of vowels in a given string

c program to count the number of vowels in a given string



#include
#include
void main()
{
  int i;
  char s1[20];
  clrscr();
  printf("\n Enter string:");
  gets(s1);
   for(i=0;s1[i]!='\0';i++)
     if(s1[i]=='A'||s1[i]=='E'||s1[i]=='I'||s1[i]=='O'||s1[i]=='U'||s1[i]=='a'||s1[i]=='e'||s1[i]=='i'||s1[i]=='o'||s1[i]=='u')
      printf("%c",s1[i]);

  getch();
}

C Program example List

Google+ Badge