C语言,输入一个字符,判断它是英文字符,数字字符还是其他字符.
2个回答
2013-10-24
展开全部
#include<stdio.h>
int main()
{
char p;
scanf("%c",&p);
if(p>='a' && p<='z' || p>='a' && p<='z')
printf("英文字符\n");
else if(p>='0' && p<='9')
printf("数字字符\n");
else
printf("其他字符\n");
return 0;
}
int main()
{
char p;
scanf("%c",&p);
if(p>='a' && p<='z' || p>='a' && p<='z')
printf("英文字符\n");
else if(p>='0' && p<='9')
printf("数字字符\n");
else
printf("其他字符\n");
return 0;
}
2013-10-24
展开全部
#include<stdio.h>
main()
{
char c;
scanf("%c",&c);
if(c>='A' && c<='Z' || c>='a' && c<='z')
printf("%c is alphabet\n", c);
else if(c>='0' && c<='9')
printf("%c is number\n", c);
else
printf("%c is other character\n", c);
}
main()
{
char c;
scanf("%c",&c);
if(c>='A' && c<='Z' || c>='a' && c<='z')
printf("%c is alphabet\n", c);
else if(c>='0' && c<='9')
printf("%c is number\n", c);
else
printf("%c is other character\n", c);
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询