Answer to Question #4541 in C++ for Rameez M Sydeek
write a c++ program to input 2 numbers and print sum, product,difference and quotient of the two nmbers
1
2011-10-11T11:59:03-0400
#include <iostream>
using namespace std;
void
main(void){
float num1, num2 = 0;
cout << "Enter first
number: ";
cin >> num1;
cout << "Enter second number:
";
cin >> num2;
cout << "Sum: " << num1 + num2
<< endl;
cout << "Product: " << num1 * num2 <<
endl;
cout << "Difference: " << num1 - num2 <<
endl;
if(num2 == 0)
& cout << "Division by zero" <<
endl;
else
& cout << "Quotient: " << num1/num2
<< endl;
cout << "\nInput 0 and press Enter exit...";
cin >> num1;
}
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!
Learn more about our help with Assignments:
C++
Comments
Leave a comment