#While循环
num = 0
i = 1
while i <= 100:
num += i
i += 1
print(num)
***************************************
#For循环
sum = 0
for i in range(1,101):
sum +=i
print(sum)
****************************************
#for循环偶数加法
sum100 = 0
for i in range(1,101):
if i % 2 == 1:
continue
sum100 += i
print(sum100)
网友评论