Law of cosines - triples: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: added wording to the REXX section header.) |
m (→{{header|REXX}}: changed the wording in the REXX section headder.) |
||
Line 378: | Line 378: | ||
This REXX version used some optimization. |
This REXX version used some optimization. |
||
Instead of coding a general purpose subroutine (or function) to solve all of the |
Instead of coding a general purpose subroutine (or function) to solve all of the |
||
task's requirements, it was decided |
task's requirements, it was decided to |
||
<br> |
<br>write three very similar '''do''' loops (triple nested) to provide the |
||
answers for the three requirements. |
answers for the three requirements. |
||
Three arguments (from the command line) can be specified which indicates the |
Three arguments (from the command line) can be specified which indicates the |
||
maximum |
maximum length of the triangle sides |
||
<br>(the default is '''13''', as per the task's requirement) for each of the |
<br>(the default is '''13''', as per the task's requirement) for each of the |
||
three types of angles ('''60º''', '''90º''', and '''120º''') for |
three types of angles ('''60º''', '''90º''', and '''120º''') for |
||
<br>the triangles. If the |
<br>the triangles. If the maximum length of the triangle's number of |
||
sides is positive, it indicates that the triangle sides are |
|||
<br>number of triangles found. |
<br>displayed, as well as a total number of triangles found. |
||
⚫ | |||
⚫ | |||
⚫ | |||
If the maximum length of the triangle sides is negative, only |
|||
⚫ | |||
⚫ | |||
⚫ | |||
<lang rexx>/*REXX pgm finds integer sided triangles that satisfy Law of cosines for 60º, 90º, 120º.*/ |
<lang rexx>/*REXX pgm finds integer sided triangles that satisfy Law of cosines for 60º, 90º, 120º.*/ |
||
parse arg s1 s2 s3 . /*obtain optional arguments from the CL*/ |
parse arg s1 s2 s3 . /*obtain optional arguments from the CL*/ |