BERKYT

Code for Leha(LUA)

Nov 12th, 2021 (edited)
619
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.27 KB | None | 0 0
  1. function division(x, y)
  2.     local denominator = x * y + math.min(x, y)
  3.     if denominator ~= 0 then
  4.         return math.max(x, (y + x)) / denominator
  5.     else
  6.         return nil
  7.     end
  8. end
  9.  
  10.  
  11. print(division(0, 0)) --division by zero
  12. print(division(1, 10)) --1.0
Add Comment
Please, Sign In to add comment