Imagine You Are Programming An Embedded Processor Using C/C++ and The Processor Does Not Contain Multiplier in Its ALU. Write A Program To

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

C/C++ PROGRAMMING

BASIC MATHEMATICS THEME:


a) Imagine you are programming an Embedded Processor using C/C++ and the
processor does not contain multiplier in its ALU. Write a program to

#include <iostream>
using namespace std;
int main()
{
int num1, num2,m=0;
cout << "Enter the first number" << endl;
//enter the first number
cin >> num1;
cout << "Enter the second number" << endl;
//enter the second number
cin >> num2;
for (int a=0 ; a < num2 ; a++)
m = m + num1;
cout << "The product of the two given numbers is
" << m << endl; //output of the product
system("pause");
return 0;
}

You might also like