1001

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)

你可能感兴趣的:(1001)