C Language Example - Determining Letters
User inputs a character, determine whether the character is a letter.
Example
#include <stdio.h>
int main()
{
char c;
printf("Enter a character:");
scanf("%c",&c);
if( (c>='a' && c<='z') || (c>='A' && c<='Z'))
printf("%c is a letter",c);
else
printf("%c is not a letter",c);
return 0;
}
Run result:
输入一个字符: a a 是字母other extensions
C Language Examples