Advertisement
31ph4n70m

Maximum_of_array.lua

Nov 27th, 2019
689
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.36 KB | None | 0 0
  1. -- lua solution to codabbey challenge 15
  2. function split(s, delimiter)
  3.     result = {};
  4.     for match in (s..delimiter):gmatch("(.-)"..delimiter) do
  5.       table.insert(result, match);
  6.     end
  7.     return result;
  8. end
  9.  
  10. inp = split(io.read(), " ")
  11. arr = {}
  12. for k, v in pairs(inp) do
  13.     table.insert(arr,tonumber(v))
  14. end
  15. table.sort(arr)
  16. print(arr[#arr], arr[1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement