# Write a program that simulates the rolling of two dice. The program should use rand to roll the first and second dice….

**Question:**

Write a program that simulates the rolling of two dice. The program should use rand to roll the first and second dice. The sum of the two values should then be calculated. [Note: Since each die can show an integer value from 1 to 6, then the sum of the two values will vary from 2 to 12, with 7 being the most frequent sum and 2 and 12 the least frequent sums.]. There are 36 possible combinations of the two dice. Your program should roll the two dice 50,000 times. Use a 2D array to tally the numbers of times each possible sum appears. Print the results in a tabular format. The player wins if the total of the diagonal elements is greater than 8350 otherwise the player loses. 9 10 Diagonal elements 6 7 8 9 10 11 Sample output: (The table formatting should look like the same as in the screen shots below) [email protected] /h/C-Neu TSD/TSD TP2 2817/week? :1422 :1381 1374 1402 : 1311 1350 1414 14151482139513821481 11443 1369 1437 1399 1493 1372 1382 1368 14511404 13811437 1346 1484 1376 1395 13631395 1365 1317 1339 13791368 1368 he sum of the diagonal elenents is 1422 1415 1437 1484 1363 1368 8489 489 is greater than 8358, the player won the game

**Click the button below to view answer!**

If you happen to run into some problem while following the steps, please make sure to let us know in the comment section below, we’ll do our best to solve it. Apart from that, you can contact us on Facebook and Twitter, however we can’t guarantee a rapid reaction time over those platform

## 0 Comments