Program to check whether a character is alphabet or not -
#include <stdio.h>
int main()
{ char ch;
printf("Enter the character ");
scanf(" %c",&ch);
if((ch>= 'A'&& ch<='Z') || (ch>='a'&& ch<='z'))
printf("Alphabet");
else
printf("Enter valid input.");
return 0;
}
Output -
Enter the character f
alphabet
#include <stdio.h>
int main()
{ char ch;
printf("Enter the character ");
scanf(" %c",&ch);
(ch>= 'A'&& ch<='Z') || (ch>='a'&& ch<='z')?
printf("Alphabet") :
printf("Enter valid input.");
return 0;
}
Output -
Enter the character f
alphabet
0 Comments