From 523a8755af5881b6b9e1a6b0395c3833e0292877 Mon Sep 17 00:00:00 2001 From: zh <2088376133@qq.com> Date: Mon, 18 Sep 2023 04:16:04 +0000 Subject: [PATCH] =?UTF-8?q?add=202209040021/chapter=5F=E6=B1=82=E4=B8=A4?= =?UTF-8?q?=E6=95=B0=E4=B9=8B=E5=92=8C.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zh <2088376133@qq.com> --- ...70\244\346\225\260\344\271\213\345\222\214" | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 "2209040021/chapter_\346\261\202\344\270\244\346\225\260\344\271\213\345\222\214" diff --git "a/2209040021/chapter_\346\261\202\344\270\244\346\225\260\344\271\213\345\222\214" "b/2209040021/chapter_\346\261\202\344\270\244\346\225\260\344\271\213\345\222\214" new file mode 100644 index 00000000..3a543f22 --- /dev/null +++ "b/2209040021/chapter_\346\261\202\344\270\244\346\225\260\344\271\213\345\222\214" @@ -0,0 +1,18 @@ +#include +int main() +{ + int n=0; + int i=1; + int sum=0; + int flag=0; + int x=0,nx=0; + scanf("%d",&n); + while(i<=n) + { + sum+=i; + if(sum>=100 && flag==0) x=sum,nx=i,flag=1; + i++; + } + printf("总和:%d\n\r",sum); + printf("第一次和大于等于100时的和为%d,此时n为%d\n\r",x,nx); +} \ No newline at end of file -- Gitee