...

Exercise: Even Numbers

In the previous exercise, the while loop was already set up for you. In this exercise, you'll write the entire loop yourself.

Your Task

Ask the user for a number, then print that many even numbers, starting from 2.

For example, if the user enters 5, your program should print the first 5 even numbers:

2
4
6
8
10
Hint: Use two separate variables: One as the loop counter, and one to keep track of the current even number.

Variables

No variables

Loading...

Output (Console)