2022-11-22 22:13发布
#includestdio.hintmyf(intm){return(1+m)*m>>1;}#includeint total(int n
#include "stdio.h"int myf(int m){ return (1+m)*m>>1;}
#include<stdio.h>int total(int n){int i,s=0; for(i=1;i<=n;i++) s+=i; return s;}int main(){ int n; scanf("%d",&n); printf("%d\n",total(n)); return 0;}
最多设置5个标签!
#include<stdio.h>
int total(int n)
{int i,s=0;
for(i=1;i<=n;i++)
s+=i;
return s;
}
int main()
{
int n;
scanf("%d",&n);
printf("%d\n",total(n));
return 0;
}
一周热门 更多>