6 ,8, 10 行用else if
/**
* @file number.c
*
* @brief
* @author Zhang Jianfa
* @copyright (C) 2021zhangjianfa. All rights reserved.
* @date 2021-10-13
*/
#include <stdio.h>
int main(int argc, char **argv)
{
char ch = 0;
scanf("%c", &ch);
if(ch >= 'a' && ch <= 'z')
printf("lower\n");
else if(ch >= 'A' && ch <= 'Z')
printf("upper\n");
else if(ch >= '1' && ch <= '9')
printf("digit\n");
else
printf("other\n");
}
root@seven:~/workspace/test/25.answer# gcc number.c
root@seven:~/workspace/test/25.answer# ./a.out
a
lower
root@seven:~/workspace/test/25.answer# ./a.out
1
digit
root@seven:~/workspace/test/25.answer# ./a.out
d^H^C
root@seven:~/workspace/test/25.answer# ./a.out
D
upperr