what problem in my code
Birthday paradox
#include<iostream>
using namespace std;
int main() {
float x=1.0;
float num=365;
float den=365;
int people=0;
float p;
cin>>p;
while(x>1-p)
{
x=x*(num)/den;
num--;
people++;
}
cout<<people;
return 0;
}
for this code of urs
add the condition when p == 1
then your answer needs to be 367
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.