Que:Your task is simple, determine the minimum number of people required in the room so that two have same birthday with probability greater than or equal to ‘p’. (Assume there are 365 days in every year)
Soln:
#include<bits/stdc++.h>
using namespace std;
int main() {
float num=365,deno=365;
float p=1;
float x;
cin>>x;
int n=0;
while(p>=(1-x))
{
p=p*(num)/(deno);
num–;
n++;
}
cout<<n;
return 0;
}
Sir Plz guide in my above code .
Thank you !