How to resolve the algorithm Sort an integer array step by step in the COBOL programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Sort an integer array step by step in the COBOL programming language
Table of Contents
Problem Statement
Sort an array (or list) of integers in ascending numerical order.
Use a sorting facility provided by the language/library if possible.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Sort an integer array step by step in the COBOL programming language
Source code in the cobol programming language
PROGRAM-ID. sort-ints.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 array-area VALUE "54321".
03 array PIC 9 OCCURS 5 TIMES.
01 i PIC 9.
PROCEDURE DIVISION.
main-line.
PERFORM display-array
SORT array ASCENDING array
PERFORM display-array
GOBACK
.
display-array.
PERFORM VARYING i FROM 1 BY 1 UNTIL 5 < i
DISPLAY array (i) " " NO ADVANCING
END-PERFORM
DISPLAY SPACE
.
You may also check:How to resolve the algorithm Magic squares of doubly even order step by step in the ALGOL 68 programming language
You may also check:How to resolve the algorithm URL decoding step by step in the PureBasic programming language
You may also check:How to resolve the algorithm Strip comments from a string step by step in the Haskell programming language
You may also check:How to resolve the algorithm File size step by step in the Aime programming language
You may also check:How to resolve the algorithm Top rank per group step by step in the Nim programming language