fork download
  1. IDENTIFICATION DIVISION.
  2. PROGRAM-ID. IDEONE.
  3.  
  4. ENVIRONMENT DIVISION.
  5.  
  6. DATA DIVISION.
  7. WORKING-STORAGE SECTION.
  8. 01 b PIC X(100) .
  9. 01 i PIC 9(3) .
  10. 01 du PIC 9(16) VALUE 0.
  11. 01 dl PIC 9(16) VALUE 0.
  12. 01 d PIC X(31) .
  13. 01 m PIC 9(16) VALUE 1000000000000000.
  14. 01 c PIC 9 .
  15. 01 q PIC 9 .
  16. 01 r PIC 9(16) .
  17.  
  18. PROCEDURE DIVISION.
  19. ACCEPT b
  20. PERFORM VARYING i FROM 1 BY 1 UNTIL i > 100
  21. COMPUTE du = du * 2
  22. COMPUTE dl = dl * 2
  23. MOVE b(i:1) TO c
  24. COMPUTE dl = dl + c
  25. DIVIDE dl BY m GIVING q REMAINDER r
  26. MOVE r TO dl
  27. COMPUTE du = du + q
  28. END-PERFORM.
  29. STRING
  30. du dl(2:15)
  31. INTO d
  32. END-STRING.
  33. DISPLAY d.
  34. STOP RUN.
  35.  
Success #stdin #stdout 0s 4008KB
stdin
0010000110000101000100100100111100011101100000111100110110110101001110101000100011010011101111110010
stdout
0165982062722070016834015149042