Computer Science, asked by kingkha, 7 months ago

write a program to input 2 numbers . check and print their LCM and HCF of two number.​

Answers

Answered by kartiksharma0711
2

Explanation:

If the two numbers are a and b and their LCM is x and their HCF is y then there is a rule that is a×b=x×y

Let's take an example. HCF of two numbers is 3 and LCM of those numbers is 90. Now product of HCF and LCM = 270. Is there anyway to find out those numbers? Now find the factors of 270 and verify Y is for yes and N is for no

2×135LCM(N)HCF(N)

3×90LCM(Y)HCF(Y)

5×54LCM(N)HCF(N)

6×45LCM(Y)HCF(Y)

9×30LCM(Y)HCF(Y)

10×27LCM(N)HCF(N)

15×18LCM(Y)HCF(Y)

Possible pairs of numbers are :

(3, 90), (6, 45), (9, 30) and (15, 18).

All the above mentioned pairs of numbers have 3 as HCF and 90 as LCM.

If LCM and HCF are given then there can be many

Similar questions