Please use Pseudocode The pseudocode below uses a random number generator and pa
ID: 3583487 • Letter: P
Question
Please use Pseudocode
Explanation / Answer
// We have a pseudocode to generate the random number from 1 to 6 and store in the current roll of die for first and second respectivly. We know doubles die occures when number appears on first die for current roll and number appears on seond die for the current roll is called doubles. We can check the doubles using if condition for each roll whose value is stored in respective die array if both value match we can increase the count ,whose initial value is assigned as 0 and it also print the message when the doubles die ocures and also display the total number of doubles occures during the 100 die roll at the last of the for loop.
the pseudo code is as follow
Start
declare
num LIMIT = 6
num die1[100],die2[100]
num diceRoll
num CNT=0,i
for diceRoll =0 to 99 step 1
die1[diceRoll]=random[LIMIT]
die2[diceRoll]=random[LIMIT]
endfor
for i=0 to 99 step 1 // for loop to vary the value of index from 0 to 99 by ste pvalue of 1
if die1[i] = die2[i] then // check the double die
//print the double die occure message
PRINT " Double Die occure at " ,(i+1) , "Roll
//increment value of count by 1
CNT=CNT+1
endif
endfor
//print the total number of double die occures during the 100 Roll
PRINT " Total Double Dies are " , CNT
stop