Hello,

I have this program that simplifies a fraction by calculating the greatest common divisor.

So the fraction 8/4 (largest common divisor = 4)

8/4 4/4 => result would be 2/1 (fraction simplified)

My problem is my method calculated this greatest common divisor.

But now that value has to be divided trough the nominator and denominator of the fraction (wich are a and b in my example).

But i cannot seem to get that dividing to work. (will i need to make a new method or simply in this one...)

Also calling up that method (another small class below the algorithm).

```
public ulong GenormBreuk(ulong a, ulong b)
{
ulong remainder;
while (b != 0)
{
remainder = a % b;
a = b;
b = remainder;
}
return a;
//part that is not working....
ulong gcd = GenormBreuk(a, b);
a = a / gcd;
b = b / gcd;
}/*GreatestCommonDivisor*/
```

Also i will call up this class in a other class (with soley conscode that contains writelines, readlines etc...).

I do not understand what arguements to pass along with that, are out parameters required?

Atm if i call up the class ber.GenormsBreuk(n , p) i will just get the value fo the GcD. Its unclear how i have to modifiy my method & the 2 arguements for below to show the result of the simplified fraction.

So the last line should contain the simplified fraction {0} for the nominator / {1} would contain the simplified denominator.

```
public void TestGCD()
{
ClsBereken Ber = new ClsBereken();
Console.WriteLine("\tTest GCD");
Console.WriteLine("\t--------");
Console.WriteLine("Give in a fraction where the denominator & the denominator\nare natural numbers different from 0\n");
Console.Write("\tNominator...");
ulong n = ulong.Parse(Console.ReadLine());
Console.Write("\tDenominator...");
ulong p = ulong.Parse(Console.ReadLine());
Console.WriteLine("\nFraction in original shape: {0}/{1}", n , p);
Console.WriteLine("Simplified fraction {0}/{1}", Ber.GenormBreuk(n, p) , ....?);
}
```

Regards.

*Edited 6 Years Ago by Nerathas*: n/a