Saturday, September 15, 2012

Code #12:C Program To Check Whether Input Alphabet Is a Vowel or Not

| |

#include <stdio.h>

main()
{
  char ch;

  printf("Enter a character\n");
  scanf("%c", &ch);

  if (ch == 'a' || ch == 'A' || ch == 'e' || ch == 'E' || ch == 'i' || ch == 'I' || ch =='o' || ch=='O' || ch == 'u' || ch == 'U')
    printf("%c is a vowel.\n", ch);
  else
    printf("%c is not a vowel.\n", ch);

  return 0;
}
Output:
Enter a Character
a
a is a vowel.

0 comments:

Post a Comment

Powered by Blogger.