subject

Write a program that reads in non-negative integers and stores and displays distinct numbers (i. e., if a number appears multiple times, it is stored and displayed only once). Your program should allow up to 1000 distinct numbers to be stored and displayed. Use the following algorithm (this is required!): Read each number and store it in an array if it is new. If the number is already in the array, ignore it. The user will indicate that they are done entering numbers by entering a negative number. Here is a sample run:

Enter a non-negative integer (negative to quit): 1
Enter a non-negative integer (negative to quit): 2
Enter a non-negative integer (negative to quit): 3
Enter a non-negative integer (negative to quit): 2
Enter a non-negative integer (negative to quit): 1
Enter a non-negative integer (negative to quit): 6
Enter a non-negative integer (negative to quit): 3
Enter a non-negative integer (negative to quit): 4
Enter a non-negative integer (negative to quit): 5
Enter a non-negative integer (negative to quit): 2
Enter a non-negative integer (negative to quit): -4
You entered:
1 2 3 6 4 5

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 21:00
It is not a good idea in a cover letter to mention another person whom the employer knows.
Answers: 1
question
Computers and Technology, 22.06.2019 17:00
1. so if i wanted to build a linux server for web services(apache) with 1cpu and 2 gb of memory.-operating at 75% of memory capacity2. a windows server with 2 cpu/ 4gb memory- operating at 85% of memory capacity3. a storage server with 1 cpu/ 2gb memory- operating at 85% of memory capacityhow much memory do i have to add for each server.so that the utilization rate for both cpu and memory is at a baseline of 60%."the details for the cpu like its processor or the memory's speed isnt to be concerned" yeah i kept asking my teacher if he's even sure about the but the whole class seems to be confused and the project is due in 3 days..this is a virtualization project where i have to virtualize a typical server into an exsi hypervisor.
Answers: 2
question
Computers and Technology, 24.06.2019 14:00
In simple terms, how would you define a protocol?
Answers: 2
question
Computers and Technology, 24.06.2019 16:00
How are roger williams, james oglethorpe, and william penn similar?
Answers: 3
You know the right answer?
Write a program that reads in non-negative integers and stores and displays distinct numbers (i. e.,...
Questions
question
Chemistry, 19.03.2020 10:27
question
English, 19.03.2020 10:27
question
Mathematics, 19.03.2020 10:27
question
Mathematics, 19.03.2020 10:27
question
Physics, 19.03.2020 10:27
Questions on the website: 13722363