Contact Learn C
Copy

Program 31:To know whether the character is vowel or not

Program 31:
 
#include<stdio.h>
main()
{
  char c;
  printf("Enter a character to know whether it is vowel or not\n");
  scanf("%c",&c);
  if(c=='A'||c=='a'||c=='e'||c=='E'||c=='I'||c=='i'||c=='O'||c=='o'||c=='U'||c=='u')
    printf("The character %c is vowel\n",c);
  else
    printf("The character %c is not vowel\n",c);
}
Explanation:
  1. The program starts with initializing :
    • c → To store Input character
  2. printf("Enter a character to know whether it is vowel or not\n");
    scanf("%c",&c);
    Taking input from user.If the input is A(say)
  3. if(c=='A'||c=='a'||c=='e'||c=='E'||c=='I'||c=='i'||c=='O'||c=='o'||c=='U'||c=='u')
    printf("The character %c is vowel\n",c);
    else
    printf("The character %c is not vowel\n",c);
    This is the main logic of the program.The input given by user is verified with all the conditions in if part.
  4. As we have given A as input then it will check with A,a,e,E,...u,U.And if any one of the character is equal to input then it is vowel else not


Output:

To know whether the character is vowel or not


Donate

Download App and Learn when ever you want

Get it on PlayStore
Get it on Amazon App Store
Get it on Aptoide