function round100(n)
    return math.floor(n*100)/100
end
function round3(n)
    return math.floor(n/3)*3
end
local signs = {
    "K",
    "M",
    "B",
    "T",
    "Qd",
    "Qn",
    "Sx",
    "Sp",
    "Oc",
    "No",
    "De",
    "UDe",
}
function shorten(n)
  if n >= 1000 then
     local num = round100(n/10^round100(round3(math.floor(math.log10(n)))))
     
     local sign = signs[round3(math.floor(math.log10(n)))/3]
     return num..sign
  else
    return n
  end
end
local num = io.read()
print(shorten(tonumber(num)))














Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: