Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
- int niza[105];
- double rekurzija(int at, double sum_do_drobna_crta_pred_at) { // indeks vo nizata
- if(at == 0) {
- return sum_do_drobna_crta_pred_at;
- }
- return rekurzija(at - 1, (double) 1.0 / (sum_do_drobna_crta_pred_at + niza[at]));
- }
- int main()
- {
- int n;
- scanf("%d", &n);
- for(int i = 0; i < n; i++) {
- scanf("%d", &niza[i]);
- }
- double rezultat = rekurzija(n - 1, 0.0);
- rezultat += (double) niza[0];
- printf("%f\n", rezultat);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement