Reference no: EM13168014
Write a C program that computes and posters the probabilities of two people in a group who are born in the same day. The probability of two people being born in the same day of the year, for a group of npeople, is given by the following formula:
P (n) = 1 - 365/365 x 364/365 x 363/365 x ... x (365-n+1)/365
Thus, if n=1, p (1) = 1- 365/365 = 0
If n=2, p (2) = 1- 365/365 x 364/365 = 0.002740; about 0.27%
If n=3, p (3) = 1- 365/365 x 364/365 x 363/365 = 0.008204; about 0.82%
Etc.
Your program must compute the probabilities of the 10 groups of 4, 8, 12, ...40 people and must print the results according to the following presentation :
Probability of 2 identical birthdays in a group of 4 people : 1.64%
Probability of 2 identical birthdays in a group of 8 people : 7.43%
...
Probability of 2 identical birthdays in a group of 40 people : 89.12%
Remarks:
-There is no reading of data to perform. The printing of the probability is expressed as a percentage with the specification of the conversion %5.2lf.To avoid any overflow capacity, use the type double in your calculations.
-You must use some comments such as:
Description of the program (author, purpose)
Description of the constants and/or the variables
-Your program must use the instruction for to compute the probabilities