Good morning,

I have an exercise that deals with arrays and random numbers. I must find the probability that in a party with an x amount of guests, what is the probability that two of them have the same birthday. As sample looks as followed:

Enter the number of guests: 30

Enter the number of parties: 10000

The probability that two guests have the same birthday is 12.34%

I have included a function prototype

int party (int n)

what I was thinking of doing within that call function is having a 3 for loops nested:

outer loop is the party, inner 2 loops would compare each guest and if both guests have the same birthday, I would return 1. It would repeat within until all guests have been compared and all parties have gone through.

Here's a little bit of what i've done so far:

#include <stdlib.h>

#include <time.h>

int party (int n);

main()

{

int guests;

int party;

int sameBday = 0;

int prob;

srand( time(NULL));

/*put printf and scanf for party and guests*/

if (party(guests))

sameBday += 1

prob = sameBday /guests * party * 100

/*to get the percentage*/

}

this is the main function. I find that my prototype may be confusing. I was wondering if any of you can steer me in another direction that seems more plausible. I don't need any codes, just some logic.

Thanks.