How do I calculate the HCF or GCD of two numbers in thunkable?

I am working on an app where The computer transforms a number from decimal to fraction. I will be to make it in the format of ex. 34/100 for 0.34, but for simplifiying the fraction, i need the hcf of the numerator and the denominator…is there any way to do that?

How would you find the HCF (highest common factor) without Thunkable? Whatever the answer is, you can then implement that in Thunkable using the Math blocks. But first you need an algorithm or method to find it.

I am trying to find that algorithm! The most mathematical I could get was the division method where you divide the greater number by the smaller one, the divide the smaller number by the remainder and so on. But it seems like a long process and there must be a smaller way.

Googling find hcf of two numbers algorithm will give you some examples of code you might use.

I’ll try

@tatiang , Thanks for your help. I found a video explaining the process -

1 Like