Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int n;
- double niza[101];
- double neprekinata_dropka(int i, double drobna_crta) {
- if(i == 0) {
- return drobna_crta;
- }
- return neprekinata_dropka(i - 1, 1.0 / (drobna_crta + niza[i]));
- }
- int main()
- {
- cin >> n;
- for(int i = 0; i < n; i++) {
- cin >> niza[i];
- }
- cout << neprekinata_dropka(n - 1, 0.0) + niza[0];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement