0% found this document useful (0 votes)
25 views1 page

"Please Enter Your Name" "Welcome " "Please Enter The Numbers Below /N/N" "Firstnum: /N" "Secondnum: /N"

This C++ program takes in two numbers from the user, calculates the sum, difference, product, and quotient of the two numbers, and displays the results. It first prompts the user for their name and welcomes them. It then asks the user to input two numbers and stores them as variables. Finally, it calculates and displays the sum, difference, product, and quotient of the two numbers entered by the user.

Uploaded by

Geneen Louise
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views1 page

"Please Enter Your Name" "Welcome " "Please Enter The Numbers Below /N/N" "Firstnum: /N" "Secondnum: /N"

This C++ program takes in two numbers from the user, calculates the sum, difference, product, and quotient of the two numbers, and displays the results. It first prompts the user for their name and welcomes them. It then asks the user to input two numbers and stores them as variables. Finally, it calculates and displays the sum, difference, product, and quotient of the two numbers entered by the user.

Uploaded by

Geneen Louise
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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