从键盘任意输入一个字符,
编程判断该字符是数字字符、英文字母、空格还是其他字符。
**输入格式要求:提示信息:"Press a key and then press Enter:"
**输出格式要求:"It is an English character!\n"
"It is a digit character!\n"
"It is a space character!\n"
"It is other character!\n"
代码如下:
#include<stdio.h>int main(){char a;printf("Press a key and then press Enter:");scanf("%c",&a);if(a>=48&&a<=57)printf("It is a digit character!\n");else if((a>=65&&a<=90)||(a>=97&&a<=122))printf("It is an English character!\n");else if(a==32)printf("It is a space character!\n");elseprintf("It is other character!\n");return 0;}
C语言程序练习题:从键盘任意输入一个字符 编程判断该字符是数字字符 英文字母 空格还是其他字符。