day9习题
1.使用while循环输出 1 2 3 4 5 6 8 9 10:
count=1
while count<11:
if count==7:
pass
else:
print(count)
count+=1
2.输出1-100的所有数的和:
i=1
s=0
while i<=100:
s=s+i
i=i+1
print(s)
3.输出1-100内的所有奇数:
i=1
while i<=100:
if i%2==1:
print(i)
else:
pass
i+=1
4.输出1-100内的所有偶数:
i=1
while i<=100:
if i%2==0:
print(i)
else:
pass
i+=1
5.输出1-2+3...+99
i=1
s=0
while i<100:
if i%2==1:
s=s+i
else:
s=s-i
i+=1
print(s)