fork(1) download
  1. #include <stdio.h>
  2. int main()
  3. {
  4. int i, x;
  5. char str[9];
  6.  
  7. scanf("%d", &x);
  8.  
  9. while(x)
  10. {
  11. i = 0;
  12.  
  13. str[i++] = x % 2;
  14.  
  15. while(x/2)
  16. {
  17. x /=2;
  18. str[i++] = x % 2;
  19. }
  20.  
  21. while(i--)
  22. {
  23. printf("%d ", str[i]);
  24. }
  25.  
  26. printf("\n");
  27.  
  28. scanf("%d", &x);
  29. }
  30.  
  31. return 0;
  32. }
Success #stdin #stdout 0s 2116KB
stdin
97
98
99
100
0
stdout
1 1 0 0 0 0 1 
1 1 0 0 0 1 0 
1 1 0 0 0 1 1 
1 1 0 0 1 0 0