# Add and Multiply 2 Numbers

Let me show you a simple C++ console application program which will add two numbers and show their sum and product.

/* Addition and Multiplication of two numbers */ #include <iostream> using namespace std; int main(void) { //variables int number1, number2, sum, product; char stay; cout << "Input first number: "; cin >> number1; cout << endl << "Input second number: "; cin >> number2; // add the two numbers sum = number1 + number2; cout << endl << "The sum is " << sum <<endl; // multiply the two numbers directly within cout cout << endl << "The product is " << number1 * number2 << endl; //let console wait for an input before exit cin >> stay; return 0; }

- number1 and number2 - to hold the values of the two numbers
- sum - to hold the value of the sum of number1 and number2
- stay - to let the program ask for an input before the console window closes.

We can also directly process the calculation within cout and have it processed directly for output. But this would depend on the implementation the program would require and for this one this can just be applied as what we wanted was directly print the results of multiplying two numbers.

Output: