Advertisement
Maria_Teodora

Conversie_din_baza_10_in_baza_b

Oct 21st, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void baza(int x, int b)
  6. {
  7.     if(x<b)
  8.         cout<<x;
  9.     else
  10.     {
  11.         baza(x/b,b);
  12.         cout<<x%b;
  13.     }
  14. }
  15.  
  16. int main()
  17. {
  18.     int x, b;
  19.     cin>>x>>b;
  20.     baza(x,b);
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement