← Back
Code Challenge 3.6 - Find Even and Odd Numbers
Objective
Separate even and odd numbers into two different collections.
Skills to Practice
- Array/List manipulation
- Indexing
- Decision Statements
Challenge Tasks
- Create a console project named Challenge 3-6.
- Prompt the user to input integer elements into a collection.
- Let the user specify the size of the collection.
- Iterate through the collection and separate the elements into two collections: one for even numbers and one for odd numbers.
- You may use lists for flexibility, but arrays can also be used if preferred.
- Display the even and odd collections to the user in a clear and formatted manner.
Sample Output
Enter the size of your collection: 6 [Enter]
Enter element 1: 10 [Enter]
Enter element 2: 25 [Enter]
Enter element 3: 18 [Enter]
Enter element 4: 31 [Enter]
Enter element 5: 22 [Enter]
Enter element 6: 29 [Enter]
Even numbers: 10 18 22
Odd numbers: 25 31 29