Write Program Using C Simulate Pair Dice Run Simulation 1000 Times Record Data Following E Q37030976

Write a program using C++ to simulate a pair of dice. Run yoursimulation 1000 times and record the data for the followingevents:

A: Sum of the outcome is even

B: Sum of the two dice is at least 10

C: The first die comes up 5

ii. Compute the probability of each event using yourprogram.


Solution


#include<iostream>

#include<cstdlib>

using namespacestd;

int main()

{

    // Sum of the outcome is even

    int even_sum =0;

   

    // Sum of the two dice is at least 10

    int sum_atleast_10 =0;

   

    // The first die comes up 5

    int first_die_5 =0;

   

    int i;

   

    for( i= 1 ; i <=1000 ; i++ )

    {

    

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.