Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#13 excel vba 13. Consider the foll owing state lottery. Five random digits are selected. This is the like at S1 per card. winning number.

#13 excel vba
image text in transcribed
13. Consider the foll owing state lottery. Five random digits are selected. This is the like at S1 per card. winning number. You can buy as many lottery cards as you Each card contains five rando number, you win $100,000. (Assume that order matters. For example, if the winning number is 21345, then 12345 doesn't win.) Write a sub that does the following. It first generates a random winning number and stores it in a string variable (so that you can use string concatenation), and it asks the user how many cards he wants to buy. It then uses a For loop to generate this many cards and store their numbers in a card array (which should be a string array). Next, it m digits. If you get a card that matches the winning uses a Do loop to keep checking cards until a winner card has been found or no more s remain. Finally, it displays a message stating whether you are a winner and your net gain or loss. Note that you can generate a single random digit from ler must commit to the 0 to 9 with Excel's RANDBETWEEN function

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

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

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions