
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

Programming in C
Two identical packs of ordinary playing cards (52 different cards in a pack) are shuffled and placed face downwards on a table. Two players then play a game of Snap. Each player is allocated one pack and at each turn in the game one card in each pack is turned up and the two upturned cards are compared. If the cards are the same (i.e. match in every respect) a snap-turn is declared. A game ends when all 52 pairs have been compared.
Write a C program which will simulate the game for the purposes of determining the probability of there being at least one snap-turn in a game. [20 marks]
Note: you may assume the existence of a random number generator but must state its properties.