1-100偶数:
sum = 0 for i in range(0,101,2): sum += i print(sum)
1-100奇数:
sum = 0 for i in range(1,101,2): sum += i print(sum)
1-100既能被3和5同时整除的数:
for i in range(1,101):
if i % 3 == 0 and i % 5 == 0:
print(i)
3*5的倍数
1-100偶数:
sum = 0 for i in range(0,101,2): sum += i print(sum)
1-100奇数:
sum = 0 for i in range(1,101,2): sum += i print(sum)
1-100既能被3和5同时整除的数:
for i in range(1,101):
if i % 3 == 0 and i % 5 == 0:
print(i)
3*5的倍数
转载于:https://www.cnblogs.com/ryuukyou/p/7364802.html