Dice Rolling
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 value 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 frequents sums.] There are 36 possible combinations of the two dice. Use an array to tally the numbers of times each possible sum appears. Print the result in tabular format.
micheal Amirul 0 Newbie Poster
Dani 4,310 The Queen of DaniWeb Administrator Featured Poster Premium Member
micheal Amirul 0 Newbie Poster
micheal Amirul 0 Newbie Poster
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.