Advertisement
Miquel_Fuster

Emahar challenge #1

Aug 11th, 2022
670
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
COBOL 0.71 KB | None | 0 0
  1. *> Challenge from emahar
  2. *> https://www.youtube.com/watch?v=F8n5_vjfjJc
  3.  
  4. program-id. emahar-challenge.
  5. data division.
  6. working-storage section.
  7. 77 i pic 99.
  8. 77 j pic 99.
  9. 77 numlen pic 9.
  10. 77 num pic xx.
  11. 77 result pic x(80).
  12.  
  13. procedure division.
  14. proc-main.
  15.   perform varying i from 1 by 1 until i is greater than 10
  16.     initialize result
  17.     perform varying j from 1 by 1 until j is greater than i
  18.       initialize numlen
  19.       inspect j tallying numlen for leading zeros
  20.       move j (numlen + 1 : ) to num
  21.       string result delimited by space
  22.              num delimited by space
  23.              into result
  24.     end-perform
  25.     display result
  26.   end-perform
  27.   stop run.
  28. end program emahar-challenge.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement