Advertisement
Josif_tepe

Untitled

Apr 30th, 2021
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int niza[400];
  5. double neprekinata_dropka(int i, double broj) {
  6.     if(i == 0) {
  7.         return broj;
  8.     }
  9.     return neprekinata_dropka(i - 1, 1.0 / (broj + niza[i]));
  10. }
  11. int main() {
  12.     int n;
  13.     scanf("%d", &n);
  14.     for(int i = 0; i < n; i++) {
  15.         scanf("%d", &niza[i]);
  16.     }
  17.     printf("%lf\n", niza[0] + neprekinata_dropka(n - 1, 0.0));
  18.     return 0;
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement