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.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Divide two integers without using multiplication, division and mod operator | Set2
- Write you own Power without using multiplication(*) and division(/) operators
- Russian Peasant (Multiply two numbers using bitwise operators)
- Calculate Bitwise OR of two integers from their given Bitwise AND and Bitwise XOR values
- Find Quotient and Remainder of two integer without using division operators
- Compute maximum of two integers in C/C++ using Bitwise Operators
- How to sum two integers without using arithmetic operators in C/C++?
- Minimum steps to convert X to Y by repeated division and multiplication
- Minimum division by 10 and multiplication by 2 required to reduce given number to 1
- Smallest string without any multiplication sign that represents the product of two given numbers
- Multiply large integers under large modulo
- Add two numbers without using arithmetic operators
- Largest of two distinct numbers without using any conditional statements or operators
- Division without using '/' operator
- Minimum possible Bitwise OR of all Bitwise AND of pairs generated from two given arrays
- Check if a number is divisible by 8 using bitwise operators
- Generate first K multiples of N using Bitwise operators
- Check if a number is multiple of 5 without using / and % operators
- C++ program to divide a number by 3 without using *, / , +, -, % operators
- Decimal to binary conversion without using arithmetic operators