#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("Please input n:");
int n,x;
scanf("%d",&n);
if(n>=1)
{
x=Sum(n);
printf ("sum=%d\n",x);
}
else
printf ("data error!\n");
return 0;
}
int Sum(int n);
{
int sum=0,i,m;
do
{sum+=i;
i++;
}
while (i<=n);
m=sum;
return m;
}
慕村225694
小唯快跑啊
相关分类