C++:Problem1

Problem:
Write a C++ program that asks the user for two integers and then outputs their sum, difference (both ways) and product Use the template for understanding proper indentation of statements.

Objective:
• cin and cout
• calculations
• proper indentation of statements
• proper usage of comment statements
• user-friendly input/out

Display:
Please input number 1: 5
Please input number 2: 10
The numbers you input are 5 and 10
The sum of 5 and 10 is: 15
The difference of 5 and 10 is: -5
The difference of 10 and 5 is: 5
The product of 5 and 10 is: 50

End of Program

Code:
#include
using namespace std;

int main ()
{
//declaration of variables
int firstnumber, secondnumber, sum, subtract1, subtract2, multiply;

//Prompt the user for input
cout << "Please input number 1: ";
cin >> firstnumber;
cout << "Please input number 2: ";
cin >> secondnumber;
cout << "The numbers you input are "<< firstnumber<<" and "<< secondnumber << endl;

//Calculation
sum = firstnumber + secondnumber;
subtract1 = firstnumber - secondnumber;
subtract2 = secondnumber - firstnumber;
multiply = firstnumber * secondnumber;

//Display output
cout<<"The sum of "<< firstnum ber << " and "<< secondnumber << " is: "<< sum << endl;
cout <<"The difference of " << firstnumber <<" and " << secondnumber << " is: " << subtract1 << endl;
cout <<"The difference of " << secondnumber <<" and " << firstnumber << " is: " << subtract2 << endl;
cout <<"The product of " << firstnumber << " and " << secondnumber << " is: " << multiply << endl;

//closing
cout << "\nEnd of Program\n\n";
return 0;
}