0

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.

3
Contributors
2
Replies
11
Views
2 Years
Discussion Span
Last Post by deceptikon
0

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

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.