Program to simulate rolling one die

Assignment Help Programming Languages
Reference no: EM1347351

Q1) Write a program which simulates rolling one die using the following steps:

1. Prompt the user for 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? 6
First roll = 5
Second roll = 1
Third roll = 3
Die total = 9
Average roll = 3

Reference no: EM1347351

Questions Cloud

Brand name products do you think have failed : What famous brand name products do you think have - What famous "brand name" products do you think have failed? Why do you think this happened? What might have been done to correct the problem?
Cvp analysis-academic approach : Avitar Corporation manufactures the line of computer memory expansion boards employed in microcomputers. The average selling price of its finished product is $175 per unit. The variable cost for these same units is $115. Avitar incurs fixed costs ..
Calculate the downward force of the water : An ideal spring has the spring constant k = 428 N/m. find the distance this spring must be stretched from its equilibrium position for 28 J of work to be done.
The theoretical m and m propositions : The differences between the theoretical M&M propositions and the practical applications for managers and where do managers say value is created?
Program to simulate rolling one die : Write a program which simulates rolling one die using the following steps: Prompt the user for the number of sides on the die.
Elucidate how much money supply will increase in response : Elucidate how much the money supply will increase in response to a new cash deposit of $500 by completing the accompanying table.
Modigliani and miller model-explantion : Modigliani and Miller model-Explantion by Example in Excel - Describe the Modigliani and Miller models of capital structure both with and without corporate income taxes.
What will be the initial speed of an arrow : A 100 g granite cube slides down a 40* frictionless ramp. At the bottom, just as it exits onto a horizontal table, it collides with a 200g steel cube at rest. How high above the table must the granite cube be released to give the steel cube a spee..
Find the effect on insurance contract : Determine what will an insurer do if it seems that an applicant misstated his or her age on life insurance application?

Reviews

Write a Review

Programming Languages Questions & Answers

  Implement functions using x86 assembly

Implement a procedure that mimics a logic unit

  Determining suitable parameters if pass-by-reference is used

Subprocedures in VBA utilize pass-by-reference. Which function or sub procedure alters its parameter?

  Program to compute percentage and final grade for students

Write a program which will permit teacher to compute percentage and final grade for students in a class.

  Program to compute person earns in a month

Write a program that calculates how much a person earns in a month if the salary is one penny the first day, two pennies the second day, four pennies the third day.

  Sql statements coded as transaction

Write a set of 3 SQL statements coded as transaction to reflect following change: United Parcel Service has been purchased by federal Express Corporation.

  Writing program of long term parking

Write an enitre program about the long term parking, and calculate the parking total fare.

  Explaining risk in fixed-price contracts

It is recognized that fixed-price contracts offer obvious advantages to buyer organizations because they transfer almost all of the risk to the contractor.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Creating printstream object using dos

Create a PrintStream object using dos and assign the resulting reference to ps, a PrintStream variable that has already been declared.

  Unix systems administration

Unix Systems Administration

  Program to fill 0s and 1s into tictactoe board

Write a program which randomly fills in 0s and 1s into TicTacToe board, prints board.

  Program to compute pearson correlation coefficient

Write down a program to compute Pearson correlation coefficient by using parallel loop templates from Intel Threading Building Blocks library (TBB).

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd