Please login

Prime

Prepinsta Prime

Video courses for company/skill based Preparation

(Check all courses)
Get Prime Video
Prime

Prepinsta Prime

Purchase mock tests for company/skill building

(Check all mocks)
Get Prime mock

Uppercase, Lowercase or special character

Write a C program to find character is a Uppercase, Lowercase or special character 

  • A character is said to be in uppercase if it is in capital letter of English language.
  • A character is said to be in lowercase if it is in small letter.
  • If A character is not an alphabet and not a number rather than character is a special character.
  • And all character have an ascii value .Now we compute a C program to check whether an entered character is in uppercase, lowercase and special character .

We know that the ASCII value of character’s 0 to 225 .In which lowercase alphabet ‘a’ to ‘z’ have a ‘97’ to ‘122’ ASCII value. And uppercase alphabet ‘A’ to ‘Z’ have a ‘65’ to ‘90’ ASCII value. And other special character have ASCII value rather than alphabet. So the program displays whether the entered character is lowercase alphabet or uppercase alphabet and special character by checking its ASCII value.

Uppercase, Lowercase or special character in C programming (3)

Working:-

       Step 1:  Insert a character (by the user)

       Step 2: Check whether the character lies between A and Z, if true, print “uppercase”

       Step 3: Check whether the character lies between a and z, if true, print “lowercase”

       Step 4: Check whether the character lies between 0 and 9, if true, print “not a character it is a number”

       Step 5: All other condition are false ,print ” it is a spacial character”

       Step 6:stop.  

C program:-

//C program
#include<stdio.h>

int main()
{
//for initialize of character
   char c;
 
//to take user input
printf("Enter any character : ");
scanf("%c",&c);

    //to find true of upper case value.
if(c>='A' && c<='Z')
printf("character is  an upper case");

//to check of lowercase character
        else if(c>='a' && c<='z')
printf("character is a lower case");
 
//to check it is not a character
else if(c>='0'&& c<='9')
printf("it is not a character");
//all condition false than
else
printf("character is a special character");

return 0;

}


 

Output:-

Enter any character :  A
character is an upper case


Enter any character : a
character is a lower case


Enter any character : 9
it is not a character


Enter any character @
character is a special character