You are on page 1of 1

1 // This program will get the sum, difference, product and quotient of two numbers

2 #include <iostream>
3 using namespace std;
4 int main()
5
6 {
7
8 // Declaring variables
9 float FirstNum, SecondNum;
10 float sum, quotient, product, difference, other_var;
11 string name;
12 cout << "Please enter your name" << endl;
13 cin >> name;
14 cout << "Welcome " << name << endl;
15
16 //take input from end-user
17 cout << "Please enter the numbers below \n\n";
18 cout << "FirstNum: \n";
19 cin >> FirstNum;
20 cout << "SecondNum: \n";
21 cin >> SecondNum;
22
23 // Calculating of values
24 sum = FirstNum+ SecondNum;
25 quotient = FirstNum/SecondNum;
26 difference = FirstNum - SecondNum;
27 product = FirstNum * SecondNum;
28
29
30 // Display of results
31 cout << "Sum = " << sum << endl;
32 cout << "Quotient = " << quotient << endl;
33 cout << "Difference = " << difference << endl;
34 cout << "Product = " << product << endl;
35
36 return 0;
37 }

You might also like