From b408afeeddd241fb1451991d32e759bef5870427 Mon Sep 17 00:00:00 2001 From: Baoshuo Ren Date: Wed, 16 Oct 2024 11:19:34 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=AE=9E=E8=B7=B5=E8=AF=BE=E5=86=85?= =?UTF-8?q?=E3=80=911.=E9=A1=BA=E5=BA=8F=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 【实践课内】1.顺序结构/7-1 计算摄氏温度.c | 11 +++++++++++ 【实践课内】1.顺序结构/7-2 逆序的三位数.c | 18 ++++++++++++++++++ 【实践课内】1.顺序结构/7-3 日期格式化.c | 11 +++++++++++ 【实践课内】1.顺序结构/7-4 21-爬楼梯.c | 11 +++++++++++ 4 files changed, 51 insertions(+) create mode 100644 【实践课内】1.顺序结构/7-1 计算摄氏温度.c create mode 100644 【实践课内】1.顺序结构/7-2 逆序的三位数.c create mode 100644 【实践课内】1.顺序结构/7-3 日期格式化.c create mode 100644 【实践课内】1.顺序结构/7-4 21-爬楼梯.c diff --git a/【实践课内】1.顺序结构/7-1 计算摄氏温度.c b/【实践课内】1.顺序结构/7-1 计算摄氏温度.c new file mode 100644 index 0000000..a94a5c9 --- /dev/null +++ b/【实践课内】1.顺序结构/7-1 计算摄氏温度.c @@ -0,0 +1,11 @@ +#include + +int main() { + int f; + + scanf("%d", &f); + + printf("Celsius = %d\n", 5 * (f - 32) / 9); + + return 0; +} diff --git a/【实践课内】1.顺序结构/7-2 逆序的三位数.c b/【实践课内】1.顺序结构/7-2 逆序的三位数.c new file mode 100644 index 0000000..493c050 --- /dev/null +++ b/【实践课内】1.顺序结构/7-2 逆序的三位数.c @@ -0,0 +1,18 @@ +#include + +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; +} diff --git a/【实践课内】1.顺序结构/7-3 日期格式化.c b/【实践课内】1.顺序结构/7-3 日期格式化.c new file mode 100644 index 0000000..89c2fce --- /dev/null +++ b/【实践课内】1.顺序结构/7-3 日期格式化.c @@ -0,0 +1,11 @@ +#include + +int main() { + int y, m, d; + + scanf("%2d-%2d-%4d", &m, &d, &y); + + printf("%04d-%02d-%02d\n", y, m, d); + + return 0; +} diff --git a/【实践课内】1.顺序结构/7-4 21-爬楼梯.c b/【实践课内】1.顺序结构/7-4 21-爬楼梯.c new file mode 100644 index 0000000..777bb23 --- /dev/null +++ b/【实践课内】1.顺序结构/7-4 21-爬楼梯.c @@ -0,0 +1,11 @@ +#include + +int a, t, b; + +int main() { + scanf("%d%d%d", &a, &t, &b); + + printf("%d", 1ll * t * (b - 1) / (a - 1)); + + return 0; +}