C program to test input symbol is alphabet or not

Previous
Next

Input

            Input character: a

Output

            ‘a’ is alphabet

#include <stdio.h>
int main()
{
	char ch;
	
	printf("Enter any character: ");
	scanf("%c", &ch);
	
	if((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'))
		printf("Character is an ALPHABET.");
	else
		printf("Character is NOT ALPHABET.");
	return 0;
}
Previous
Next

Add Comment

Courses Enquiry Form