Sunday, March 7, 2010

HOW TO PRINT NUMBER OF VOWELS IN A STRING USING C PROGRAM


main()
{
 char c;
 int count = 0;
 clrscr();
 cout<<"\nENTER THE STRING(~ TO TERMINATE) : ";
 do
 {
  c=getchar();
  if( (c=='A' || c=='a') || (c=='E' || c=='e') || (c=='I'|| c=='i') || (c=='O' || c=='o') || (c=='U' || c=='u'))
  {
   count++;
  }
 }while(c!='~');
 cout<<"THE NUMBER OF VOWELS PRESENT IS : "<<<"\n";
 getch();
 return 0;
}

No comments:

Post a Comment