‘C’ program to check if character is alphabet, digit or special symbol.

C File =>


/* Write a ‘C’ program to accept a character and check if it is alphabet,  digit or special symbol. If it is an alphabet, check if it is uppercase or  lowercase. */

#include<stdio.h>
#include<ctype.h>
int main() 
{
      char c;
 
      printf("\n Enter any character : ");
      scanf("%c",&c);
 
      if(isalpha(c))
     {
          if(islower(c))
             printf("\n Lowercase alphabet");
         else
             printf("\n Uppercase alphabet");
      }
      else if(isdigit(c))
            printf("\n You entered Digit");
      else
            printf("It is a special symbol");
 
      return 0;
}

Comments

Popular posts from this blog

Write a program to allocate memory dynamically for n integers. Accept the elements and calculate their sum and average

C program to accept names of n cities and search for city named “Pune”.