Computer Science, asked by dcsnrb849619, 8 months ago

How to write a pseudo code that multiply positive integers x and y by using addition and subtraction only.

Answers

Answered by ranveer5175
0

Answer:

bla bla bla bla bla bla lol

Answered by JAYADADI
1

Answer:

  • PLEASE MARK ME AS BRAIN LIST

// C++ program to Multiply two integers without  

// using multiplication, division and bitwise  

//  operators, and no loops  

#include<iostream>  

 using namespace std;  

class GFG  

{  

/* function to multiply two numbers x and y*/

public : int multiply(int x, int y)  

{  

   /* 0 multiplied with anything gives 0 */

 if(y == 0)  

   return 0;  

     /* Add x one by one */

   if(y > 0 )  

   return (x + multiply(x, y-1));  

     /* the case where y is negative */

   if(y < 0 )  

   return -multiply(x, -y);  

}  

};  

 // Driver code  

int main()  

{  

   GFG g;  

   cout << endl << g.multiply(5, -11);  

   getchar();  

   return 0;  

}  

 

Similar questions