406,469 views
20 votes
20 votes
# Your task is to modify the previous examples code to

# print out all the even numbers from 1 to N where N is
# an int from the user

# Your task is to modify the previous examples code to # print out all the even numbers-example-1
User Vijay Sebastian
by
3.2k points

1 Answer

21 votes
21 votes

Answer:

n = int(input('N: '))

for i in range(1, n + 1):

if i % 2 == 0:

print(i)

User Massmaker
by
2.4k points