Answered step by step
Verified Expert Solution
Link Copied!

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 ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Java Programming And Data Structures Comprehensive Version

Authors: Y. Daniel Liang

12th Edition

0136520235, 978-0136520238

More Books

Students also viewed these Programming questions

Question

How are the square numbers embedded in Pascals triangle?

Answered: 1 week ago