60 465
Assignments Done
98,1%
Successfully Done
In April 2018

Answer to Question #33155 in C++ for Ha Na Choi

Question #33155
Write a C++ program which reads values for two floats and outputs their sum, product and quotient. Include a sensible input prompt and informative output.
Expert's answer
#include <iostream>


using namespace std;


int main(){
float a, b;
cout << "Input two numbers: ";
cin >> a >> b;


cout << "Sum is: " << a + b << endl;
cout << "Product is: " << a * b << endl;
if( b != 0 ) cout << "Quotient is: " << a / b << endl;
else cout << "Division by zero" << endl;


return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions