#include <iostream>
#include <cmath>
using namespace std;
double fact(int n) {
double f = 1;
for (int k = 2; k <= n; k++)
f *= k;
return f;
}
int main() {
double P = 1;
for (int i = 2; i <= 5; i++) {
P *= pow(1 - 1.0 / fact(i), 2);
}
cout << "P = " << P << endl;
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: