Multiply a number by 15 without using * and / operators | C ++ implementation of the approach ; Function to return ( 15 * N ) without using ' * ' or ' / ' operator ; prod = 8 * n ; Add ( 4 * n ) ; Add ( 2 * n ) ; Add n ; ( 8 * n ) + ( 4 * n ) + ( 2 * n ) + n = ( 15 * n ) ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; long multiplyByFifteen ( long n ) { long prod = ( n << 3 ) ; prod += ( n << 2 ) ; prod += ( n << 1 ) ; prod += n ; return prod ; } int main ( ) { long n = 7 ; cout << multiplyByFifteen ( n ) ; return 0 ; }