2024-10-14 14:39:40
2024-10-14 10:22:59
#include <stdio.h>
void main()
{
int n;
scanf("%d", &n);
printf("sum=%d\n", n*(n+1)/2);
}
2024-10-14 09:34:03
2024-10-14 17:52:23
#include<stdio.h>
int main(void)
{
int i,a,sum=0;
scanf("%d",&a);
for(i=1;i<=a;i++)
{
sum+=i;
}
printf("%d",sum);
return 0;
}