Well I do not know what programming language you are using and am back on the FORTRAN era myself but perhaps something like:
read a and b
find the prime factors of a and b
Here is how to write such a program:
https://www.geeksforgeeks.org/print-all-prime-factors-of-a-given-number/
then make them the same
for example if a = 2*3*5
and b = 2*3* 7
then multiply a by 7 and b by 5
Write a program that will accept two numbers. The program must calculate the LCM and HCF of the numbers and display it.
2 answers
Accept two numbers and display the HCF