Birthday Paradox Test Case 7 Giving Timelimit

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 !

You are not handling for the case if p=0 or p=1.
Just handle these cases.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.