Advertisement
CosminVarlan

Solutie_admitere_2019_I2c

Apr 8th, 2022
1,215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.24 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int F(int n){
  7.     if (n!=0)
  8.     {
  9.         if (n%2==0) return 2*F(n/2)+1;
  10.         else return 2*F(n/2);
  11.     }
  12.     else return 0;
  13. }
  14.  
  15.  
  16. int main()
  17. {
  18.     cout << F(510);
  19.     return 0;
  20. }
  21.  
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement