Advertisement
Guest User

10>2

a guest
Oct 19th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int x,y;
  7. int z = 0;
  8. cout << "Podaj liczbe w systemie dziesietnym:" << endl;
  9. cin >> x;
  10.  
  11. while (x>0)
  12. {
  13. z++;
  14. int h = z-1;
  15. y = x%2;
  16. x = x/2;
  17. int tab[z];
  18. tab[h] = y;
  19.  
  20. if (x==0)
  21. {
  22. for (int i=0; i<z; i++)
  23. {
  24. cout << tab[h--];
  25. }
  26. }
  27. }
  28. return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement