1001

2017-09-06  本文已影响26人  Lancy233

http://acm.hdu.edu.cn/showproblem.php?pid=1001


题目要求:输入一个整数n,从1开始,一到n,数字相加求和


i = 1
s = 0
n = float(input())
n1 = n +1
while i< n1:
   s = s + i
   i = i + 1
print(s)
上一篇 下一篇

猜你喜欢

热点阅读