Search This Blog


Thursday, 18 April 2019

C Program to Check Vowel or Consonant

WELCOME BACK TO codejunction.in . HOPE YOU ENJOYING OUR OTHER BLOGS TOO.



In English, five alphabets A, E, I, O, and U are called as Vowels. All the remaining alphabets except these five are called as consonants.





C Program to Check Vowel or Consonant

IN THIS PROGRAM THE USER NEEDS TO ENTER A ALPHABET AND THEN THE PROGRAM WILL PRINT VOWEL AND CONSONANT ACCORDING TO THE ALPHABET.


CODE

#include <stdio.h>
 
int main()
{
  char ch;
 
  printf("Enter a character\n");
  scanf("%c", &ch);
 
  // Checking both lower and upper case
 
  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 isn't a vowel.\n", ch);
     
  return 0;
}


OUTPUT



No comments:

Post a Comment