Hey, I have done some code for the birthday paradox, but I keep getting weird percentages like 3.3 or 2.5 (which is supposed to be about 70% with 30 guests)..
Here's what I have done...

Code:
```#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define SIZE 366

int party (int n);
main()
{
int trial, bday, n, guests;
float percent, total, i;
printf("How many parties are there? ");
scanf("%d", &trial);
printf("How many guests attend? ");
scanf("%d", &guests);
srand(time(NULL));
for (i=1; i<=trial; i++)
{
bday = party(n);
}
if (bday == 1)
{
total += 1;
}
percent = (float)total/guests*100.0;
printf("The Probablity of people with the same birthday is %0.2f\n", percent);
}
int party (int n)
{
int days;
int frequency [SIZE] = {0};
days = 1 + rand() % 365;
++frequency[days];
if (frequency[days] <= 2)
{
return 1;
}
else
{
return 0;
}
}```
Any help will be appreciated, thanks!

2. Your party function doesn't use n at all -- it will always return 1.

3. > int party (int n)
You don't use n

> int frequency [SIZE] =
This has no memory of previous calls.

> if (frequency[days] <= 2)
How is frequency[days] anything other than 1 ?