#include <iostream>
#include <cmath>
using namespace std;
long double fact(int N)
{
if (N < 0)
return 0;
if (N == 0)
return 1;
else
return N * fact(N - 1);
}
signed main()
double d;
int N;
long double pr = 1;
cin >> N >> d;
for (int i = 1; i <= N; i++)
pr *= (pow(d, 3) + 2.8) / (fact(i) + 9);
cout << pr;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
#include <cmath>
using namespace std;
long double fact(int N)
{
if (N < 0)
return 0;
if (N == 0)
return 1;
else
return N * fact(N - 1);
}
signed main()
{
double d;
int N;
long double pr = 1;
cin >> N >> d;
for (int i = 1; i <= N; i++)
pr *= (pow(d, 3) + 2.8) / (fact(i) + 9);
cout << pr;
return 0;
}