编辑代码

function f1(a,b)
    local s
    s= a+b
    return s
end
function f2(a,b)
    local s
    s= a-b
    return s
end
function f3(a,b)
    local s
    s= a*b
    return s
end
function f4(a,b)
    local s
    s= a/b
    return s
end
function f(c,a,b)
    if c=='+' then 
        return f1(a,b)
        end
    if c=='-' then 
        return f2(a,b)
        end
    if c=='*' then 
        return f3(a,b)
        end
    if c=='/' then 
        return f4(a,b)
        end
end
print("请输入你要进行的运算:(+,-,*,/)")
c = io.read()
print("请输入第一个数:")
a = io.read()
print("请输入第二个数:")
b = io.read()
print(f(c,a,b))