版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zheweizhe/article/details/72231857
代码
/*01.
02.*程序的版权和版本声明部分
03.*Copyright(c)2017,陕西科技大学镐京学院
04.*All rightsreserved.
05.*文件名称:
06.*作者:郑伟哲
07.*完成日期:2017年5月15日
08.*版本号:v1.0
09.*输入描述:
10.*问题描述:求1+2+3+~~~··+100. 和
11.
12.做了这题的心得,刚写这个问题时我不会用一循环
比如 for函数,do while while if函数
13.有哪些不明白
14.运行状况:
15.*/
#include <stdio.h>
int main()
{
int i,sum;
i=1;
sum=0;
while(i<=100)
{
sum=sum+i;
i++;
}
printf("%d",sum);
return 0;
}
运行结果
心得
刚写这个问题时我不会用一循环
比如 for函数,do while while if函数 还的加油看书