Write Recursive Function Multiply Two Positive Integers M N Using Repeated Addition Specif Q37143627

Write a recursive function to multiply two positive integers mand n by using repeated addition. Specify the base case and therecursive case. The function prototype is

int multiply(int m, in n)

Note: I need help to write out this problem in C++ whileusing Visual Studio 2017


Solution


#include <iostream>using namespace std;int multiply(int m, int n) { if (m == 0) { return 0; } else { return n + multiply(m – 1, n); }}int main() {

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.