Description
输入一个字符,判断字符的类型,即字母(alpha)、数字(numeric)和其它字符(other)。
Input
一个字符。
Output
字符的类型,alpha、numeric或other。
Sample Input
A
Sample Output
alpha
#include<stdio.h>
int main()
{
char ch;
scanf("%c",&ch);
if(ch>=‘a’&&ch<=‘z’||ch>=‘A’&&ch<=‘Z’)
printf(“alpha”);
else if(ch>=‘0’&&ch<=‘9’)
printf(“numeric”);
else
printf(“other”);
return 0;
}
Problem 5: 判断字符类型
最新推荐文章于 2022-10-30 14:55:46 发布