Example & Tutorial understanding programming in easy ways.

Write a program to check alphabet is in UPPER case or not

UPPERcase alphabet:

Example-
A,B,C,D,.........,X,Y,Z

All these alphabet is the upper case.
ASCII value for upper case alphabet:
A=65
B=66
C=67
.....
Y=89
Z=90

program-

#include < stdio.h>
int main()
{
char ch;
printf("Enter any alphabet\n");
scanf("%c",&ch);
if((ch>='A' && ch<='Z'))
{
printf("It is the upper case alphabet");
}
else
{
printf("It is not the upper case alphabet");
}
return 0;
}


output-

Enter any character
F
It is the upper case alphabet

Enter any character
l
It is not the upper case alphabet

-In this program, we take a input of the alphabet and check whether it is a upper case or not.
-if((ch>='A' && ch<='Z'))
will execute if alphabet is of UPPER case otherwise it implies as lower case alphabet.




Read More →