题目描述
输入一个字母,若是小写字母,则变为大写输出,否则,原样输出 。
输入
输入为一个字母a 。
输出
输出为转换后的字母,单独占一行 。
样例输入
a
样例输出
A
代码
#include <stdio.h>
int main()
{
char c;
scanf("%c", &c);
if(c>='a' && c<='z')
c = c - 32;
printf("%c\n", c);
return 0;
}
或者
#include <stdio.h>
#include <ctype.h>
int main()
{
char c;
scanf("%c", &c);
if(islower(c))
c = toupper(c);
printf("%c\n", c);
return 0;
}