Advertisement
Guest User

lll

a guest
Jan 30th, 2015
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int dec_i(int liczba,int pod)
  6.  
  7. {
  8. int wynik=0,p=1;
  9.  
  10. while(liczba>0)
  11. {
  12. wynik=wynik+p*(liczba%pod);
  13. liczba=liczba/pod;
  14. p=p*8;
  15. }
  16. return wynik;
  17.  
  18. }
  19. int i_dec(int liczba,int pod)
  20.  
  21. {
  22. int wynik=0,p=1;
  23.  
  24. while(liczba>0)
  25. {
  26. wynik=wynik+p*(liczba%5);
  27. liczba=liczba/5;
  28. p=p*pod;
  29. }
  30. return wynik;
  31.  
  32. }
  33.  
  34. int main()
  35. {
  36.  
  37. int a,pod;
  38. cin>>a;
  39. cout<<dec_i(i_dec(a,8),5);
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement