Question: C PROGRAMMING Write a program to simulate a pick-5 lottery game. Your program must generate and store 5 distinct random numbers between 1 and 9

C PROGRAMMING

Write a program to simulate a pick-5 lottery game.

Your program must generate and store 5 distinct random numbers between 1 and 9 (inclusive) in an array.

The program prompts the user for:

an integer random seed

five distinct integers between 1 and 9 (which are stored in another array)

The program then compares the two arrays to determine if they are identical.

If the two arrays are identical, then the user wins the game.

otherwise, the program outputs the number of matching digits and their position in the array.

For Example:

Enter an integer random seed: 45 To play the Pick-5 game, enter five integers bewteen 1 and 9 (inclusive): 1 2 3 4 5 You didn't match any numbers! The winning numbers are: 6, 3, 5, 1, 4 Enter an integer random seed: 45 To play the Pick-5 game, enter five integers bewteen 1 and 9 (inclusive): 6 3 1 2 3 You only matched 2 numbers. Your numbers matched the Pick-5 numbers at position(s): 0, 1 The winning numbers are: 6, 3, 5, 1, 4 Enter an integer random seed: 45 To play the Pick-5 game, enter five integers bewteen 1 and 9 (inclusive): 6 3 5 1 4 Congratulations!!! You WIN!!! The winning numbers are: 6, 3, 5, 1, 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!