Answer to Question #256521 in Algorithms for Israel

Question #256521

Algorithm for a program that generates 1000 random numbers between 0 and 100 000. Display the number of odd values generated as well as the smallest and the largest values. Output should be displayed in a windows message box.

 



1
Expert's answer
2021-10-25T11:02:00-0400
Start
   Declare variable integer min = 100000000
   Declare variable integer max = -100000000
   for i = 0 to 1000
      Set number = generate random number
      if number mod 2 == 1 then
           Display number
           if number < min then
                min = number
           end if
           if number > max then
                max = number
           end if
     end if
     Display min 
     Display max
Stop

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS