4.2 案例:1-100的和

案例

num = 1
sum = 0

while num <=100:
    sum += num
    num += 1

print("1-100的和:", sum)

Last updated

Was this helpful?