mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-11-23 15:48:42 +00:00
【实践课内】1.顺序结构
This commit is contained in:
parent
1e0c23a743
commit
b408afeedd
11
【实践课内】1.顺序结构/7-1 计算摄氏温度.c
Normal file
11
【实践课内】1.顺序结构/7-1 计算摄氏温度.c
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int f;
|
||||||
|
|
||||||
|
scanf("%d", &f);
|
||||||
|
|
||||||
|
printf("Celsius = %d\n", 5 * (f - 32) / 9);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
18
【实践课内】1.顺序结构/7-2 逆序的三位数.c
Normal file
18
【实践课内】1.顺序结构/7-2 逆序的三位数.c
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int x;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
scanf("%d", &x);
|
||||||
|
|
||||||
|
int res = 0;
|
||||||
|
|
||||||
|
while (x) {
|
||||||
|
res = (res * 10) + (x % 10);
|
||||||
|
x /= 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%d\n", res);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
11
【实践课内】1.顺序结构/7-3 日期格式化.c
Normal file
11
【实践课内】1.顺序结构/7-3 日期格式化.c
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int y, m, d;
|
||||||
|
|
||||||
|
scanf("%2d-%2d-%4d", &m, &d, &y);
|
||||||
|
|
||||||
|
printf("%04d-%02d-%02d\n", y, m, d);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
11
【实践课内】1.顺序结构/7-4 21-爬楼梯.c
Normal file
11
【实践课内】1.顺序结构/7-4 21-爬楼梯.c
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int a, t, b;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
scanf("%d%d%d", &a, &t, &b);
|
||||||
|
|
||||||
|
printf("%d", 1ll * t * (b - 1) / (a - 1));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user