Advertisement
Josif_tepe

Untitled

Oct 6th, 2021
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int n;
  5. double niza[101];
  6. double neprekinata_dropka(int i, double drobna_crta) {
  7.     if(i == 0) {
  8.         return drobna_crta;
  9.     }
  10.     return neprekinata_dropka(i - 1, 1.0 / (drobna_crta + niza[i]));
  11. }
  12. int main()
  13. {
  14.     cin >> n;
  15.     for(int i = 0; i < n; i++) {
  16.         cin >> niza[i];
  17.     }
  18.    
  19.     cout << neprekinata_dropka(n - 1, 0.0) + niza[0];
  20.     return 0;
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement