Advertisement
a53

SumaPuteri2

a53
Jan 27th, 2020
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.20 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int n;
  7. cin>>n;
  8. int p=1;
  9. while(n)
  10. {
  11. if(n%2)
  12. cout<<p<<' ';
  13. p*=2;n/=2;
  14. }
  15. return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement