Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- double fact(int n) {
- double x = 1;
- for (int i = 1; i <= n; ++i) {
- x *= i;
- }
- return x / (n + 1);
- }
- int main()
- {
- double sum=0;
- for (int i = 1; i <= 10; ++i) {
- sum += fact(i);
- }
- cout << setprecision(3*10) << sum << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement