write my assignment 3907

DiceWrite a program that simulates rolling one die using the following steps:1.Prompt the user for the number of sides on the die.2."Roll" the die three times by generating a random number between 1 (inclusive) and the number of sides (inclusive).3.Keep track of the running sum of the rolls for the die and output the sum and average for the three rolls at the end.4.You can set up one integer variable named roll, and reuse it with each roll of the die. You will also need a variable named total, initialized to zero.Sample Output:How many sides on die? 6First roll = 5Second roll = 1Third roll = 3Die total = 9 Average roll = 3 How many sides on die? 20First roll = 14Second roll = 20Third roll = 9Die total = 43 Average roll = 14.333

DiceWrite a program that simulates rolling one die using the following steps:1.Prompt the user for the number of sides on the die.2.”Roll” the die three times by generating a random number between 1 (inclusive) and the number of sides (inclusive).3.Keep track of the running sum of the rolls for the die and output the sum and average for the three rolls at the end.4.You can set up one integer variable named roll, and reuse it with each roll of the die. You will also need a variable named total, initialized to zero.Sample Output:How many sides on die? 6First roll = 5Second roll = 1Third roll = 3Die total = 9 Average roll = 3 How many sides on die? 20First roll = 14Second roll = 20Third roll = 9Die total = 43 Average roll = 14.333

 
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"

Comments are closed.

Hi there! Click one of our representatives below and we will get back to you as soon as possible.

Chat with us on WhatsApp