题解 | #判断是不是字母#
判断是不是字母
http://www.nowcoder.com/practice/91a588dd4cd244bfa616f17603ec123c
#include<stdio.h>
//A-Z == 65-90
//a-z == 97-122
//\n == 10
int main() {
char ar;
while (scanf("%c", &ar) != EOF) {
if (ar == 10) continue;
if (ar >= 65 && ar <= 90 || ar >= 97 && ar <= 122)
printf("%c is an alphabet.\n", ar);
else printf("%c is not an alphabet.\n", ar);
}
return 0;
}
//A-Z == 65-90
//a-z == 97-122
//\n == 10
int main() {
char ar;
while (scanf("%c", &ar) != EOF) {
if (ar == 10) continue;
if (ar >= 65 && ar <= 90 || ar >= 97 && ar <= 122)
printf("%c is an alphabet.\n", ar);
else printf("%c is not an alphabet.\n", ar);
}
return 0;
}