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