fork(11) download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. char output[100] = "";
  5. double x = 0.625;
  6. while (x) {
  7. int ch;
  8. double chk = x * 2;
  9. if (chk < 1) ch = '0'; else ch = '1';
  10. sprintf(output, "%s%c", output, ch);
  11. x = chk;
  12. if (x >= 1) x -= 1;
  13. }
  14. printf("Representacao final: 0.%s\n", output);
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 2156KB
stdin
Standard input is empty
stdout
Representacao final: 0.101