We can multiply a number by 7 using bitwise operator. First left shift the number by 3 bits (you will get 8n) then subtract the original numberfrom the shifted number and return the difference (8n – n).
Time Complexity: O(1)
Space Complexity: O(1)
Note: Works only for positive integers.
Same concept can be used for fast multiplication by 9 or other numbers.
- Multiply two polynomials
- Multiply a given Integer with 3.5
- Multiply the given number by 2 such that it is divisible by 10
- Program to multiply two matrices
- 8085 program to multiply two 8 bit numbers
- Multiply any Number with 4 using Bitwise Operator
- Python program to multiply two matrices
- 8086 program to multiply two 16-bit numbers
- 8085 program to multiply two 16-bit numbers
- BigDecimal multiply() Method in Java
- 8086 program to multiply two 8 bit numbers
- Multiply a number with 10 without using multiplication operator
- Array Queries for multiply, replacements and product
- C Program to Multiply two Floating Point Numbers
- Python | Multiply all numbers in the list (3 different ways)
Improved By : vt_m