(12C) Maximum Size of Square Area in a Rectangle - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (12C) Maximum Size of Square Area in a Rectangle (/thread-11034.html) |
(12C) Maximum Size of Square Area in a Rectangle - Gamo - 07-11-2018 05:00 AM This program calculate the exact "Maximum Size of the Square Area" and how many Squares fit inside a Rectangle. Procedure: Given size of the Rectangle is Length = 6 Width = 4 6 ENTER 4 // This input can be switch around (4 ENTER 6) R/S --> 2 // Answer for the maximum square size R/S --> 6 // Answer for how many square fit inside a rectangle Program: Maximum Square Area inside a Rectangle Quote:01 STO 1 Gamo RE: (12C) Maximum Size of Square Area in a Rectangle - Dieter - 07-11-2018 06:59 AM (07-11-2018 05:00 AM)Gamo Wrote: This program calculate the exact "Maximum Size of the Square Area" and I am not sure if you have realized it, but this maximum square size simply is the Greatest Common Divisor (GCD) of the two numbers. So you can use the GCD program posted some time ago instead. On the other hand the current program can be improved. Take a closer look: you store the input in R1 and R2 but then these two registers are only used once to recall the original input before the loop starts. He is another version: Code: 01 STO 0 Example: 4 [ENTER] 6 [R/S] => 2 [X<>Y] => 6 Dieter |