Adsense 728 * 15

Search

Custom Search

C++ Program to Multiply two numbers without using (*) Multiplication Operator

Write a  C++ Program to multiply two numbers without using (*) multiplication operator. In this program, We are going to write a code which takes two input numbers and multiply them without using multiplication operator.


Program to subtract two numbers without using subtraction operator

Add two numbers without using addition operator


C++ Program to multiply two numbers without using (*) multiplication operator


#include <iostream>

using namespace std;

int main() {

   int fnum, snum, mult=0,i;

   
   /* Input two numbers from a user. */
   
   cout << "Enter two numbers";
   cin >> fnum >> snum;
   
   
   /* Add the number using loop. */

   for(i=0; i < fnum; i++){
    
      mult = mult + snum;
   }
   
    cout << "Multiplication of two numbers is "<<mult;
    
 return 0;
}


Output:

 Enter two numbers : 4
3

Multiplication of two numbers is 12

No comments:

Post a Comment