From 2b23eadf39e35e540e97e70ae465f3e3e829c40b Mon Sep 17 00:00:00 2001 From: smallkun Date: Fri, 21 Feb 2025 09:51:15 +0800 Subject: [PATCH] Auto commit --- 2207/C语言同步练习源码/2.循环结构-7.c | 16 ++++++++++++++++ 2207/C语言同步练习答案.md | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 2207/C语言同步练习源码/2.循环结构-7.c diff --git a/2207/C语言同步练习源码/2.循环结构-7.c b/2207/C语言同步练习源码/2.循环结构-7.c new file mode 100644 index 0000000..3080245 --- /dev/null +++ b/2207/C语言同步练习源码/2.循环结构-7.c @@ -0,0 +1,16 @@ +#include + +int main(){ + + int month, total = 2, i; + scanf("%d", &month); + + for(i=1;i<=month;i++){ + if(i%3==0){ + total *= 2; + } + printf("%d:%d\n", i, total); + } + + return 0; +} diff --git a/2207/C语言同步练习答案.md b/2207/C语言同步练习答案.md index d9045c9..56e2a32 100644 --- a/2207/C语言同步练习答案.md +++ b/2207/C语言同步练习答案.md @@ -338,6 +338,22 @@ int main(){ ![image-20250220231022607](https://yp.smallkun.cn/markdown/image-20250220231022607.png!compress) ```c +#include + +int main(){ + + int month, total = 2, i; + scanf("%d", &month); + + for(i=1;i<=month;i++){ + if(i%3==0){ + total *= 2; + } + printf("%d月:%d个数\n", i, total); + } + + return 0; +} ``` ### 循环结构-8