题解 | #小乐乐求和#
小乐乐求和
http://www.nowcoder.com/practice/ce0b2eacd3d04647831358c2876e44ff
#include <stdio.h>
int main()
{
long int n,i=0,s=0;
scanf("%d",&n);
for(;i<=n;i++)
s+=i;
printf("%ld",s);
return 0;
}
小乐乐求和
http://www.nowcoder.com/practice/ce0b2eacd3d04647831358c2876e44ff
#include <stdio.h>
int main()
{
long int n,i=0,s=0;
scanf("%d",&n);
for(;i<=n;i++)
s+=i;
printf("%ld",s);
return 0;
}
相关推荐