#include<stdio.h>
main()
{
int i,n,sum;
printf("请输入n的值:");
scanf("%d",&n);
sum=0;
for(i=1;i<=n;i++)
{
sum=sum+i;
}
printf("sum=%d\n",sum);
}
main()
{
int i,n,sum;
printf("请输入n的值:");
scanf("%d",&n);
sum=0;
for(i=1;i<=n;i++)
{
sum=sum+i;
}
printf("sum=%d\n",sum);
}