如何简化的馏分馏分

2023-09-11 01:59:52 作者:ぁ血刹风云城ぁ

我想简化我的应用程序的一小部分。该部分是什么样子, 的x / y,其中x和y是整数。 我想简化分数到其最简单的形式。 任何人都可以请给我提示如何做到这一点。 先谢谢了。

I want to simplify a fraction in my application. The fraction is like, x/y where x and y are integers. I want to simplify the fraction to its simplest form. Can anyone please give me hints how to do it. Thanks in advance.

推荐答案

计算最大公约数x和y 的GCD划分两者

Euclid算法是一个简单的方法来计算GCD。

Euclid's algorithm is an easy way to compute the GCD.