fork download
  1. #include <stdio.h>
  2. #define NOERROR 0
  3. int bit(int n)
  4. {if(n==1){
  5. printf("1");
  6. return 0;}
  7. bit(n/2);
  8. if(n%2==0)
  9. printf("0");
  10. else
  11. printf("1");
  12. return 0;
  13.  
  14. }
  15. int main()
  16. {
  17. int x;
  18. do
  19. {
  20. printf("0以上の整数を入力してください:");
  21. scanf("%d",&x);
  22. }
  23. while( x<0 );
  24. bit(x);
  25. printf("\n");
  26. return NOERROR;
  27. }
Success #stdin #stdout 0s 5316KB
stdin
8
stdout
0以上の整数を入力してください:1000