Write a program that simulates the rolling of two dice. The program should use r
ID: 3617682 • Letter: W
Question
Write a program that simulates the rolling of two dice. The program should
use rand() to roll the first die and should use rand() again to roll the
second die. The sum of the two values should then be calculated. Your program
should roll the dice 120,000 times. Tally the numbers of times each possible
sum appears. Print the results in tabular format. Also, determine if the
totals are reasonable, i.e. there are six ways to roll a 7, so approximately
one-sixth of all the rolls should be 7.
Expected Output:
Sum Total Expected Actual
2 3373 2.778% 2.811%
3 6707 5.556% 5.589%
4 9955 8.333% 8.296%
5 13151 11.111% 10.959%
6 16763 13.889% 13.969%
7 19922 16.667% 16.602%
8 16714 13.889% 13.928%
9 13445 11.111% 11.204%
10 9927 8.333% 8.273%
11 6742 5.556% 5.618%
12 3301 2.778% 2.751%