Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function division(x, y)
- local denominator = x * y + math.min(x, y)
- if denominator ~= 0 then
- return math.max(x, (y + x)) / denominator
- else
- return nil
- end
- end
- print(division(0, 0)) --division by zero
- print(division(1, 10)) --1.0
Add Comment
Please, Sign In to add comment