Leetcode——08.05. 递归乘法

在这里插入图片描述
在这里插入图片描述

class Solution 
{
public:
    int multiply(int A, int B) 
    {
        B--;
        if(B>0)    
        {
            return multiply(A,B)+A;
        }
        else
        {
            return A;
        }
    }
};
发布了48 篇原创文章 · 获赞 23 · 访问量 1306

猜你喜欢

转载自blog.csdn.net/qq_37724465/article/details/104323531
今日推荐