Example & Tutorial understanding programming in easy ways.

Write a program to check given char is alphabet or not.

Alphabet characters:
All english character are the alphabet characters.

Example-
a,b,c,d,...............x,y,z
A,B,C,D,...............X,Y,Z

How we identify?
-We use te ASCII value concept to identify each and every character of the keyword.
ASCII value for lower case alphabet:
a=97,b=98,.........z=122
ASCII value for upper case alphabet:
A=65,B=66,..........Z=90

program-

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

output:

Enter any character
D
Yes D is a character

Enter any character
&
It is not a alphabet




Read More →
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!