Skip to content

Instantly share code, notes, and snippets.

@kaworun
Created February 2, 2013 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaworun/4698268 to your computer and use it in GitHub Desktop.
Save kaworun/4698268 to your computer and use it in GitHub Desktop.
四則演算。
x = io.read()
y = io.read()
z = io.read()
function sum2(x, y, z)
if z == "+" then
print(x .. z .. y .. "=" .. x + y)
elseif z == "-" then
print(x .. z .. y .. "=" .. x - y)
elseif z == "*" then
print(x .. z .. y .. "=" .. x * y)
elseif z == "/" then
print(x .. z .. y .. "=" .. x / y)
end
end
sum2(x, y, z)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment