s
o
u
l
s
j
i
e

计算1+2+...+100之和<for循环的学习>

#include <stdio.h>
/*
计算1+2+....+100
soulsjie 20170525
*/
void main(){
	int i;
	int s=0;
	for(i=0;i<=100;i++)
	{
		s+=i;
	}
	printf("1-100之和是:%d\n",s);
}

 

 

posted @ 2017-05-25 17:35  soulsjie  阅读(621)  评论(0编辑  收藏  举报
你累吗?累就对了,当你觉得累时证明你在走上坡路!-----NotFoundObject - 2016-12-14 08:43