Example & Tutorial understanding programming in easy ways.

Write a program to check alphabet is in lower case or not?

Lower-case alphabet:

Example-
a,b,c,d,...........,x,y,z

All these alphabet is of lower case.
ASCII value for lower case alphabet:
a=97
b=98
c=99
.....
y=121
Z=122

program-

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


output-

Enter any character
l
It is the lower case alphabet

Enter any character
A
It is not the lower case alphabet

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




Read More →