zzulioj 1026: 字符类型判断

题目描述
从键盘输入一个字符,判断该字符是否大写字母、小写字母、数字字符或其他字符。分别输出对应的提示信息。
输入
输入一个字符。
输出
如果该字符是大写字母,则输出“upper”;若是小写字母,则输出“lower”;若是数字字符,则输出“digit”;若是其他字符,则输出“other”。(输出不含双引号)。
样例输入 Copy
1
样例输出 Copy
digit

#include<stdio.h>
#include<ctype.h>
int main()
{
    
    
	char ch;
    ch=getchar();
	if(islower(ch))
	  printf("lower\n");
	  else if(isupper(ch))
	    printf("upper\n");
	    else if(isdigit(ch))
	      printf("digit\n");
	      else
	        printf("other\n");
	return 0;
}

猜你喜欢

转载自blog.csdn.net/m0_53024529/article/details/112742982