Waliullah8328

Finding alphabet,vowel,consonant,digit,Spcial character in C

Jun 9th, 2021
680
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     char ch;
  6.    
  7.     printf("Enter any character: ");
  8.     scanf("%c", &ch);
  9.  
  10.       if(ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z')
  11.             {
  12.                 printf("%c is a Alphabet : ",ch);
  13.                 if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' || ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U') {
  14.                     printf("It is a Vowel");
  15.                 }
  16.                 else
  17.                 {
  18.                   printf("It is a Consonant");
  19.                 }
  20.             }
  21.             else if(ch=='0'|| ch=='1' || ch=='2' || ch=='3'|| ch=='4'|| ch=='5'|| ch=='6'|| ch=='7'|| ch=='8'|| ch=='9')
  22.             {
  23.                 printf("%c is a digit\n",ch);
  24.             }
  25.             else
  26.             {
  27.                 printf("%c is a special character\n",ch);
  28.             }
  29.        
  30.    
  31.  
  32.     return 0;
  33. }
RAW Paste Data