fork download
  1. #include <iostream>
  2.  
  3. int main() {
  4. int input = 3405692606; //should be 11001010111111101011111010111110
  5. int result[32] = {};
  6. int index = 0;
  7.  
  8. while (input != 0) {
  9. if (input & 1)
  10. result[index] = 1;
  11. else
  12. result[index] =0;
  13. input >>= 1;// dividing by two
  14. index++;
  15. }
  16.  
  17. for(int i=0; i<32; ++i)
  18. std::cout << result[i] << ' ';
  19. }
Runtime error #stdin #stdout 0s 2924KB
stdin
Standard input is empty
stdout
Standard output is empty