Advertisement
Qpel

funkcijos 1 užd rekursija

Mar 22nd, 2017
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. double rekursija(double x, int n);
  7.  
  8. int main()
  9. {
  10.  
  11.     cout << rekursija(5, 2);
  12.     return 0;
  13. }
  14.  
  15. double rekursija(double x, int n){
  16.     if (n==256){
  17.         return pow(x,2) + n / pow(x,2);
  18.     }
  19.     else{
  20.         return pow(x,2) + n / rekursija(x, pow(n,2));
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement