daily pastebin goal
39%
SHARE
TWEET

Untitled

a guest Dec 16th, 2018 51 in 85 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. unsigned long long fact(int n)
  7. {
  8.     int a;
  9.     if (n < 0 ) return 0;
  10.     if (n == 0) return 1;
  11.     a=n * fact(n - 1);
  12.     return a;
  13. }
  14.  
  15. int main()
  16. {
  17.     int n;
  18.     cout << "Enter number: " << endl;
  19.     cin >> n;
  20.  
  21.     double sum = 0;
  22.     for (int i = 0; i <= n; ++i) {
  23.         sum += fact(i) / (i * i + 1.);
  24.     }
  25.     cout << sum;
  26.     system("pause");
  27.     return 0;
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top