Commit 72bc5a3c authored by YukiOtake's avatar YukiOtake

add sum.c

parent c3810995
No preview for this file type
#include<stdio.h>
int main(void){
int sum=0,num;
printf("好きな数字を入力してください:");
scanf("%d",&num);
for(int i=1;i<=num;i++){
sum=sum+i;
}
printf("1~%dまでの合計は%dです。\n",num,sum);
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment