Question
C++ Programming The Powerball lottery allows participants to pick 5 numbers from numbers ranging from 1 to 69 and a Powerball number ranging from 1
C++ Programming The Powerball lottery allows participants to pick 5 numbers from numbers ranging from 1 to 69 and a Powerball number ranging from 1 to 26. The odds of winning is calculated by using the formula: (n! / (n-r)! * r!) * 26. So, the odds of winning the lottery is (69! / (64! * 5!)) * 26 = 292201338. NOTE that n! means the factorial of the number n. Because, Lottery process may change, write a program to read the upper value of the range of the numbers to pick (i.e. 69), number of numbers to select (i.e., 5) and the upper value of the range of the Powerball number (i.e., 26). Calculate the display the odds of winning the Lottery using the above formula. USE FUNCTIONS. For example, I need a function that calculates the factorial of any number. NOTE: Factorial calculation is a very simple calculation of the product of the numbers starting from 1 to the number desired for the factorial calculation. For example, factorial of 5 is 1*2*3*4*5 = 120.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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