text: Multiply two integers without using multiplication , division and bitwise operators , and no loops | C ++ program to Multiply two integers without using multiplication , division and bitwise operators , and no loops ; function to multiply two numbers x and y ; 0 multiplied with anything gives 0 ; Add x one by one ; the case where y is negative ; Driver code
code: #include <iostream> NEW_LINE using namespace std ; class GFG { public : int multiply ( int x , int y ) { if ( y == 0 ) return 0 ; if ( y > 0 ) return ( x + multiply ( x , y - 1 ) ) ; if ( y < 0 ) return - multiply ( x , - y ) ; } } ; int main ( ) { GFG g ; cout << endl << g . multiply ( 5 , -11 ) ; getchar ( ) ; return 0 ; }