Multiply a number by 15 without using * and / operators | Function to perform Multiplication ; prod = 8 * n ; Add ( 4 * n ) ; Add ( 2 * n ) ; Add n ; ( 8 * n ) + ( 4 * n ) + ( 2 * n ) + n = ( 15 * n ) ; Driver code
def multiplyByFifteen ( n ) : NEW_LINE INDENT prod = ( n << 3 ) NEW_LINE prod += ( n << 2 ) NEW_LINE prod += ( n << 1 ) NEW_LINE prod += n NEW_LINE return prod NEW_LINE DEDENT n = 7 NEW_LINE print ( multiplyByFifteen ( n ) ) NEW_LINE