Advertisement
AquaBlitz11

[t004] divide

Oct 9th, 2018
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.24 KB | None | 0 0
  1. #include<stdio.h>
  2. double func(int n)
  3. {
  4.     if(n==0)
  5.         return 1;
  6.     else
  7.     {
  8.         return func(n-1)+(1/func(n-1));
  9.     }
  10. }
  11. int main()
  12. {
  13.     int n;
  14.     scanf("%d",&n);
  15.     func(n);
  16.     printf("%lf",func(n));
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement