Lab 9 - Subroutine, array, nested loop
Create a perl program that simulates a popular lottery. The program ask the user to enter the number of quickpicks. Quickpick are an array of 6 integer in the range 1-49 inclusive.
The program should then generate requested number of quickpicks and display them to the user. You don't have to check for uniqueness of each number in a single array. Use a subroutine to generate random numbers. The subroutine should take a parameter that set the maximum of the range of numbers that can be generated by the subroutine.
You program should generate the following output:
How Many quick picks you want?5
Quickpick number 1:
41 8 18 27 18 4
Quickpick number 2:
37 23 33 47 26 18
Quickpick number 3:
27 11 24 41 25 26
Quickpick number 4:
4 28 1 41 1 30
Quickpick number 5:
25 34 37 16 35 44
41 8 18 27 18 4
Quickpick number 2:
37 23 33 47 26 18
Quickpick number 3:
27 11 24 41 25 26
Quickpick number 4:
4 28 1 41 1 30
Quickpick number 5:
25 34 37 16 35 44
Comments
Post a Comment