-- 154x53 (WINDOW SIZE)
local FUNCS = {}
function GetPercentage(Value, Accuracy, DecimalPlacement)
if Accuracy then
return string.format("%." .. DecimalPlacement .. "f", Value * 100)
else
return math.floor((Value * 100) + 0.5)
end
end
local num1 = math.random(1000, 9999)
local num2 = math.random(1000, 9999)
function FIX(Num1, Num2)
if Num1 >= Num2 then
print("Num1:", Num1)
print("Num2:", Num2)
local difference = Num1 - Num2
print("Difference:", difference)
local new = Num2 + difference
print("New Value:", new)
return new
else
print("ERR: NO REASON TO CALL THE FIX FUNCTION")
end
end
if num1 >= num2 then
print("NUM1 NEEDS TO BE LOWER THAN (OR EQUAL TO) NUM2 FOR PERCENTAGE ESTIMATE")
print("FIXING...\n")
FIX(num1, num2)
print("(NEW) Num1 Value:", num1)
print("Num2 Value:", num2)
local yes = num1 / num2
if num1 < num2 then
print(GetPercentage(yes) .. "%")
else
print("FIXING AGAIN")
FIX(num1, num2)
end
else
local yes = num1 / num2
print(GetPercentage(yes) .. "%")
--3546 / 9345
end
return FUNCS
To embed this project on your website, copy the following code and paste it into your website's HTML: