Task: Observe the C++ source code below. Modify the source code in order to writ
ID: 3561724 • Letter: T
Question
Task: Observe the C++ source code below. Modify the source code in order to write a C++ program that will calculate and display the sum of two given numbers, the difference of two given numbers, the product of two given numbers, and the quotient of two given numbers. Use a calculator to predict the outputs for the following inputs: a = 5.2 b 3.4 Test your program to verify that it produces the predicted outputs. Note: You should use the keyword float (inside of int) when declaring your variables. Note: A float is a data type which can store numbers that contain a decimal point.Explanation / Answer
#include<iostream>
using namespace std;
int main()
{
float a,b;
cout<<"enter two numbers: ";
cin>>a>>b;
cout<<"sum="<<a+b<<endl;
cout<<"difference="<<a-b<<endl;
cout<<"product="<<a*b<<endl;
cout<<"quotient="<<a/b;
return 0;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.