write a program in c to check whether a character is alphabet or not?
Answers
Answered by
3
void main()
{
char alphabet;
printf("Enter a character");
scanf("%c",&alphabet);
if(alphabet >= 'a' && alphabet <= 'z') || (alphabet >= 'A' && alphabet <= 'Z')
{
printf("%c is an Alphabet");
}
else
{
printf("%c is not an Alphabet");
}
getch();
}
{
char alphabet;
printf("Enter a character");
scanf("%c",&alphabet);
if(alphabet >= 'a' && alphabet <= 'z') || (alphabet >= 'A' && alphabet <= 'Z')
{
printf("%c is an Alphabet");
}
else
{
printf("%c is not an Alphabet");
}
getch();
}
Answered by
0
Answer:
#include <stdio.h>
int main()
{
char ch;
printf("enter the character");
scanf("%c",&ch);
if((ch>='a'&&ch<='z')||(ch>='A'&&ch<='z'))
{
printf("it is alphabet");
}
else{
printf("it is not alphabet");
}
return 0;
}
output:-
enter the character A
it is alphabet
Similar questions