+ 1
You are given a program that outputs all the numbers from 0 to 10. Change the code to make it output only the even numbers.
x = 0 while x<=10: if x%2 == 0: print(x) x+=1
3 odpowiedzi
+ 2
x = 0
while x<=10:
x+=1
if x%2 == 0:
print(x)
+ 2
You need to increase x on each iteration – not only when x is even.
+ 2
x = 0
while x<=10:
print(x)
x+=2