#求解1+2+3+...+100
Sum = 0
number = 1
while number <= 100 :
Sum=Sum+number
number += 1 #可以写成 number=number+1
print("一到一百之和为:",Sum)
用python语言编写从一到一百累加之和
最新推荐文章于 2023-07-16 15:10:53 发布
#求解1+2+3+...+100
Sum = 0
number = 1
while number <= 100 :
Sum=Sum+number
number += 1 #可以写成 number=number+1
print("一到一百之和为:",Sum)