给定2个int类型的参数x和y,要求编写一个函数,用加法和减法实现x*y

def cheng(a: int, b: int) -> int():
    min_num = min(a, b)
    max_num = max(a, b)
    res = 0
    for i in range(0, min_num):
        res += max_num
    return res


print(cheng(4, 7))
原文地址:https://www.cnblogs.com/hchan/p/12931761.html