Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. int liczba;
  7. cin >> liczba;
  8.  
  9. string wynik;
  10.  
  11. while(liczba){
  12. wynik = (liczba%2?"1 \n":"0 \n") + wynik;
  13. liczba /= 2;
  14. }
  15. string wypisz = string ( wynik.rbegin(), wynik.rend() );
  16. cout << wypisz;
  17.  
  18. return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement