C program to Check Whether a Character is an Alphabet or not
Learn C - C tutorial - c program to check whether a character is an alphabet or not - C examples - C programs
C program to Check Whether a Character is an Alphabet or not
- If you have check whether the character is an alphabet or not the given input is not present between "a to z" (alphabet), then the given input is not an alphabet.
Sample Code
#include <stdio.h>
int main()
{
char c='g';
printf("character:g\n");
if( (c> ='a' && c<='z') || (c> ='A' && c<='Z'))
printf("Given input is an alphabet.",c);
else
printf("Given input is not an alphabet.",c);
return 0;
}
Output
character: g
Given input is an alphabet.