Write a c program to check character is alphabet or not
Answers
Explanation:
You can also check the alphabet using the ASCII values of characters like this: if((ch >= 97 && ch <= 122) (ch >= 65 && ch <= 90)) printf("The entered character %c is an Alphabet",ch); else printf("The entered character %c is not an Alphabet",ch); ... C Program to reverse a string.
Answer:
#include <stdio.h>
int main()
{
char ch;
/* User have to insert the character which will be later checked by the condition*/
printf("enter the character");
scanf("%c",&ch);
/* this is the condition to check the character entered by the user is alphabet or not*/
if((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z'))
{
printf("it is alphabet");
}
else
{ /*this message will be displayed if the character is not what is given in the condition*/
printf("it is not an alphabet");
}
return 0;
}
Output:-
enter the character A
it is an alphabet