Due: June 5, 2025
Points: 100
Call your program tttd.c. You can find an executable for it in the directory /home/bishop/hw5.
Now, breathe deeply and calm down. We will do this in steps; you only have to turn the final program in to Canvas (not Gradescope).
int bday[] = { 1, 2, 3, 4, 5, 5, 2 };
then hasduplicates(bday) returns 1 and if
int bday[] = { 1, 2, 3, 4, 5, 6, 7 };
then hasduplicates(bday) returns 0.
For 2 people, the probability of 2 birthdays in common is 0.001400 For 3 people, the probability of 2 birthdays in common is 0.006600 For 4 people, the probability of 2 birthdays in common is 0.015200 For 5 people, the probability of 2 birthdays in common is 0.025400 For 6 people, the probability of 2 birthdays in common is 0.041400 For 7 people, the probability of 2 birthdays in common is 0.053000 For 8 people, the probability of 2 birthdays in common is 0.082000 For 9 people, the probability of 2 birthdays in common is 0.092200 For 10 people, the probability of 2 birthdays in common is 0.121800Hint: Don’t be surprised if your probabilities are slightly different than the ones shown in the sample output. As randomness is involved, it is very unlikely your numbers will match the ones shown here.
To turn in: Please call your program bday.c and submit it through Canvas (not Gradescope). A sample executable is available on the CSIF in the directory /home/bishop/hw5.
|
ECS 36A, Programming and Problem Solving Version of May 26, 2025 at 8:56AM
|
You can also obtain a PDF version of this. |