Even and Odd

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
Java

Given an integer N, print all even numbers between 1 and N on one line and all odd numbers between 1 and N on another line.

Input Specification

The first and only line will contain a single integer N (2 \leq N \leq 100).

Output Specification

The first line of output will contain all integers between 1 and N, inclusive, that are even, separated by a space.

The second line of output will contain all integers between 1 and N, inclusive, that are odd, separated by spaces.

Sample Input 1

4

Sample Output 1

2 4
1 3

Sample Input 2

10

Sample Output 2

2 4 6 8 10
1 3 5 7 9

Comments

There are no comments at the moment.