Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void zamianana6(int a)
  6. {
  7.  
  8. int j=0;
  9. int reszta;
  10. int tablica[1000];
  11.  
  12. do{
  13. reszta = a%6;
  14. a = a/6;
  15. tablica[j]=reszta;
  16. j++;
  17. //cout << a <<endl;
  18. if(a/6<0){
  19. reszta = a%6;
  20. tablica[j]=reszta;
  21. j++;
  22. }
  23. }
  24. while (a/6!=0);
  25.  
  26.  
  27.  
  28. for(int i=j; i>=0; i--)cout<<tablica[i];
  29.  
  30. }
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38. int main()
  39. {
  40. int a;
  41. cout<<"Liczba : ";
  42. cin>>a;
  43.  
  44. zamianana6(a);
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement