Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question B. (15 marks] Write a program to do the following tasks. Generate x random integers, the values of which are in the range [2,

image text in transcribed

Question B. (15 marks] Write a program to do the following tasks. Generate x random integers, the values of which are in the range [2, y]. The values of x and y are decided by the user, and both no larger than 100. Calculate and print the number of times each integer in [2, y] occurred in these x random integers. For example, suppose x=9, y=6 and the generated random integers are 4, 4, 3, 6, 4, 4, 3, 2, 6 then the result is w! where 2: 1" means 2 occurs once, 3:2" means 3 occurs twice and so on. Print the values in [2, y] in decreasing order of the number of times they occurred. If two values in [2, y] occurred the same number of times, they should be decreasingly ordered by their own values. With the above example, the result is 4, 6, 3, 2,5 where 6 is ordered before 3 since 6 is larger than 3, although they both occuired twice

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The World Wide Web And Databases International Workshop Webdb 98 Valencia Spain March 27 28 1998 Selected Papers Lncs 1590

Authors: Paolo Atzeni ,Alberto Mendelzon ,Giansalvatore Mecca

1st Edition

3540658904, 978-3540658900

More Books

Students also viewed these Databases questions

Question

What must a creditor do to become a secured party?

Answered: 1 week ago

Question

7. Identify six intercultural communication dialectics.

Answered: 1 week ago