How to resolve the algorithm Loops/Nested step by step in the OoRexx programming language
Published on 12 May 2024 09:40 PM
        
        
        
        
    How to resolve the algorithm Loops/Nested step by step in the OoRexx programming language
Table of Contents
Problem Statement
Show a nested loop which searches a two-dimensional array filled with random numbers uniformly distributed over
[ 1 , … , 20 ]
{\displaystyle [1,\ldots ,20]}
. The loops iterate rows and columns of the array printing the elements until the value
20
{\displaystyle 20}
is met. Specifically, this task also shows how to break out of nested loops.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Loops/Nested step by step in the OoRexx programming language
Source code in the oorexx programming language
numbers = .array~new()
do i = 1 to 10
    do j = 1 to 10
        numbers[i,j] = random(1, 20)
    end
end
do i = 1 to numbers~dimension(1)
    do j = 1 to numbers~dimension(2)
        say numbers[i,j]
        if numbers[i,j] = 20 then
            leave i
    end
end
  
    You may also check:How to resolve the algorithm Determine if a string has all unique characters step by step in the REXX programming language
You may also check:How to resolve the algorithm Queue/Usage step by step in the PL/I programming language
You may also check:How to resolve the algorithm Copy a string step by step in the X86 Assembly programming language
You may also check:How to resolve the algorithm Top rank per group step by step in the ALGOL 68 programming language
You may also check:How to resolve the algorithm Higher-order functions step by step in the Icon and Unicon programming language