Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a simple lottery program using C. A user will input four integer values between 0 and 9. Your program will then randomly generate
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 user's 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 user's inputs. If all the four numbers are the same, then declare "Strike. Otherwise, "Loose". See Figure 4 for sample execution and output. Activate Enter an integer value between and 9 2 Enter an integer value between 0 and 9: 9 Enter an integer value between and 9: 19 3 Invalid input. Integer should be between and 9 only. Try again. Enter an integer value between 0 and 9 Enter an integer value between Your input numbers are 293 6 and 9: 6 Computer generated numbers are 1 8 1 7 *********** RESULTS ***************** Loose Figure 4: Sample lottery program output.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
include stdio h include stdlib h include time h int main int userNumbers4 int computerNumbers4 int i ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started