为什么这两个程序输出会不一样
第一个
num = 0
sum = 0
while num <= 1000:
num = num + 1
if num % 2 == 1:
continue
sum = sum + num
print(sum)
第二个
num = 0
sum = 0
while num <= 1000:
num = num + 2
if num % 2 == 1:
continue
sum = sum + num
print(sum)
第一个
num = 0
sum = 0
while num <= 1000:
num = num + 1
if num % 2 == 1:
continue
sum = sum + num
print(sum)
第二个
num = 0
sum = 0
while num <= 1000:
num = num + 2
if num % 2 == 1:
continue
sum = sum + num
print(sum)
2021-08-03
举报