Guest User

Untitled

a guest
Feb 6th, 2015
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int a;
  8. int d;
  9. cin>> a;
  10. int c = 0;
  11. //10->2
  12. while(c<1)
  13. {
  14. d = a%2;
  15.  
  16. if(d==1)
  17. {
  18.  
  19. cout<<"1";
  20. a= a-1;
  21. a= a/2;
  22. }
  23.  
  24. else
  25. {
  26. cout<<"0";
  27. a=a/2;
  28. }
  29. if(a<1)
  30. {
  31.  
  32. c =c+1;
  33. }
  34. }
  35.  
  36.  
  37. cout<<endl;
  38. system("pause");
  39. return 0;
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment