By making use of recursion, we can multiply two integers with the given constraints.
To multiply x and y, recursively add x y times.
Time Complexity: O(y) where y is the second argument to function multiply().
Please write comments if you find any of the above code/algorithm incorrect, or find better ways to solve the same problem.
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Write you own Power without using multiplication(*) and division(/) operators
- Divide two integers without using multiplication, division and mod operator | Set2
- Russian Peasant (Multiply two numbers using bitwise operators)
- Find Quotient and Remainder of two integer without using division operators
- Check if a number is divisible by 8 using bitwise operators
- How to sum two integers without using arithmetic operators in C/C++?
- Multiply large integers under large modulo
- Find subsequences with maximum Bitwise AND and Bitwise OR
- Median in a stream of integers (running integers)
- Multiply two polynomials
- Efficient way to multiply with 7
- Program to multiply two matrices
- Multiply the given number by 2 such that it is divisible by 10
- Division without using '/' operator
- DFA based division