Write a program that reads N integers into an array. Then prints on a separate line the value of each distinct element along with the number of times it occurs. The values should be printed in descending order. One solution to this problem is to get input numbers and store them in array A. Then traverse thisarray A to find distinct number and the times they occur. Finally, sort all distinct numbers (with the times
they occur).
Requirement:
? Your program shall be able to process at least 20 integers as input;
? You don't have to investigate the output of rand();
Hint:
? You can declare an array of size larger or equal to 20 to store input ints;
? You can either ask ahead for the number of ints user is going to input, like following:
(These are not full examples of what the output of your program should be)
This program counts the number of times distinct input number
occurs.
How many input numbers are there?10
Please input 10 numbers:-7 3 3 -7 5 5 3 4 -6 4
Totally 10 input ints:
-7 3 3 -7 5 5 3 4 -6 4