Sunday, September 16, 2018

24. WAP to determine whether a character entered through keyboard is a lower case alphabet, an upper case alphabet, a digit or a special character using ASCII value.

#include<stdio.h>
#include<conio.h>
void main()
{
   char ch;
   printf("Enter the character: ");
   scanf("%c",&ch);
   if(ch>=97 && ch<=122)
    printf("\n'%c' is a Lower Case Character.",ch);
   else if(ch>=65 && ch<=90)
    printf("\n'%c' is an Upper Case Character.",ch);
   else if(ch>=48 && ch<=57)
      printf("\n'%c' is a Digit.",ch);
   else
    printf("\n'%c' is a Special Character.",ch);
   getch();
}


Output:





Please have a look at the below lesson posted on my YouTube channel:


No comments:

Post a Comment