求1-100内所有的奇数和所有的偶数

1-100内所有的奇数:

1 i  = 1
2 while i < 101:
3     if i % 2 != 0:
4         print(i)
5     i = i + 1

1-100内所有的偶数:

1 i  = 1
2 while i < 101:
3     if i % 2 == 0:
4         print(i)
5     i = i + 1

猜你喜欢

转载自www.cnblogs.com/lym1985/p/9670753.html