C program to check character is uppercase or not without using function

C program to check character is uppercase or not without using function:
If you are using any software then below program will not give an error, but if you are using TURBO C then you have to make some changes like: void main() and some function like clrscr() or getch().

#include<stdio.h>
int main()
{
   char ch;
   printf("Enter The Character :\n");
   scanf("%c",&ch);

   if(ch>='A'&& ch<='Z')
    {
      printf("Character is UpperCase");
    }
   else if(ch>='a'&&ch<='z')
    {
      printf("Character is Not UpperCase");
    }
   else
    {
      printf("Non alphabet character");
    }
}

OUTPUT:

Enter The Character :
r
Character is Not UpperCase


Enter The Character :
R
Character is UpperCase

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.