Question: Create a simple lottery program using C. A user will input four integer values between 0 and 9. Your program will then randomly generate four
Create a simple lottery program using C. A user will input four integer values between 0 and 9. Your program will then randomly generate four random integer numbers and compare them with the users inputs. Use a two-dimensional array to store all numbers, i.e. user inputs in column 1 and computer generated numbers in column 2 of the array.
Your program should also prompt user to re-enter the value if it exceeds 9. Likewise, if the input is less than 0, your program should also prompt for re-entry.
Declare Win if at least two consecutive computer generated numbers are the same as users inputs. If all the four numbers are the same, then declare Strike. Otherwise, Loose.
See below figure for sample execution and output.

Enter an integer value between 0 and 9 2 Enter an integer value between 0 and 9 9 Enter an integer ualue between and 9 19 Invalid input Integer should be between 0 and 9 only. Try again Enter an integer value between 0 and 9 3 Enter an integer value between 0 and 9 6 Your input numbers are 29 36 Computer generated numbers are 1 8 17 RESULTS Loose
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
