Question: Write a Java program that reads in ten numbers and displays the number of distinct numbers and the distinct numbers separated by exactly one space.

Write a Java program that reads in ten numbers and displays the number of distinct numbers and the distinct numbers separated by exactly one space. In other words, if a number appears multiple times, it is displayed only once.

Hint: Read a number and store it in an array if it is new. If the number is already in the array, ignore it. After the input, the array contains the distinct numbers.

Step by Step Solution

3.37 Rating (166 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

CODE import javaio class distinct public static void mainString argsthrows IOExcept... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!