SCENARIO
You must type in a list of numbers and make sure that in the list, there are no identical numbers; in other words, no number must appear twice in the list.
When entering a new number, make sure that the number does not exist in the list yet.
If it does, then display an error message to the user.
If the number does not yet exist, then add it to the list; also, make sure that the number entered is odd for a position where index is odd, and the number must be even at a position of even index.
See figure below.
Finally, display all numbers in the list.
HINTS:
For this assignment, it will be preferable to use a “while” loop or a “do{} while” loop.
The index counter must be incremented only when the number entered is valid!
Use the operator “%” to determine if a number is odd or even.

Recommended Answers

All 2 Replies

SCENARIO
Student tries to write code to solve their problem. When they cant figure it out on their own, they go to message boards to get help finding where they went wrong.

HINTS:
The student is you, bro :(
Show Some Code

All I see is a homework assignment, which violates our rules. Please show us your honest attempt and ask an actual question.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.