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.
makungu 0 Newbie Poster
ryantroop 177 Practically a Master Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
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.