立即学习:https://edu.csdn/course/play/10534/378125?utm_source=blogtoedu
#include <stdio.h>
int main() {
char x = '\0';
int diff = 'a' - 'A';
printf("please input a char: ");
scanf("%c", &x);
if (x >= 'A' && x <= 'Z') {
printf("%c\n", x + diff);
} else if (x >= 'a' && x <= 'z') {
printf("%c\n", x - diff);
} else {
printf("%c\n", x);
}
return 0;
}
#include <stdio.h>
int main() {
unsigned int score = 0;
char grade = '\0';
printf("please input your score: ");
scanf("%d", &score);
if (score >= 90) {
grade = 'A';
} else if (score >= 60) {
grade = 'B';
} else {
grade = 'C';
}
printf("%c\n", grade);
return 0;
}
#include <stdio.h>
int main() {
char x = 'a';
while (x <= 'z') {
printf("%d ", x++);
}
printf("\n=================\n");
x = 'A';
while (x <= 'Z') {
printf("%d ", x++);
}
printf("\n=================\n");
x = '0';
while (x <= '9') {
printf("%d ", x++);
}
return 0;
}
更多推荐
学习笔记(51):C语言入门到精通-char类型
发布评论