hi reddit!
Admin Password
fractions_division()

//argument0 = x1
//argument1 = y1
//argument2 = x2
//argument3 = y2
//argument4 = reduced or not reduced (true or false)

//E.g : fractions_subtraction(10,15,30,47) --> 10/15 / 30/47


var denominator numerator xx yy;

numerator = argument0*argument3;
denominator = argument1*argument2;

xx = numerator;
yy = denominator;

if argument4 = true
{
while (xx mod 2)=0 && (yy mod 2)=0
{
xx = xx/2;
yy = yy/2;
}
while (xx mod 3)=0 && (yy mod 3)=0
{
xx = xx/3;
yy = yy/3;
}
while (xx mod 4)=0 && (yy mod 4)=0
{
xx = xx/4;
yy = yy/4;
}
while (xx mod 5)=0 && (yy mod 5)=0
{
xx = xx/5;
yy = yy/5;
}
while (xx mod 6)=0 && (yy mod 6)=0
{
xx = xx/6;
yy = yy/6;
}
while (xx mod 7)=0 && (yy mod 7)=0
{
xx = xx/7;
yy = yy/7;
}
while (xx mod 8)=0 && (yy mod 8)=0
{
xx = xx/8;
yy = yy/8;
}
while (xx mod 9)=0 && (yy mod 9)=0
{
xx = xx/9;
yy = yy/9;
}
}

return string(xx)+"/"+string(yy)
View count: 102

Enjoy the site? Donations are helpful - even just $1


Free Text Host is brought to you by Dagon Design
This site contains no adware, spyware, or popups
Questions? Comments?           Report abuse here