40. Even Numbers Till N

Acceptance — 0 accepted 0 submissions

Easy
Loops
No companies listed
The PT teacher asks students standing at even positions to step forward. Given N, print all even numbers from 2 to N in one line.

Input Format
A single integer N.

Output Format
Print the even numbers from 2 to N separated by single spaces.

Constraints
• 2 ≤ N ≤ 1000

Example 1

Input
10
Output
2 4 6 8 10

Explanation Even numbers up to 10 are 2, 4, 6, 8 and 10.

Example 2

Input
7
Output
2 4 6

Explanation 7 is odd, so the list stops at 6.

Example 3

Input
2
Output
2

Explanation Only one even number: 2.

Acceptance —
Accepted 0
Submissions 0
Auto-save
Saved Ln 1, Col 1
Submit a solution to see its status here.
Input
Expected Output
2 4 6 8 10
No results yet
Run your code to test it against the sample cases.
Problem List