Answer to Question #39195 in C++ for muse
Write a c++ program to find the sum of 0.123 * 1000 and 0.456 *100
and write the result in three significant digits.
1
2014-03-03T12:58:28-0500
#include <cstdlib>
#include<iostream>
using namespace std;
int main(int argc, char** argv) {
double sum = 0.123 * 1000 + 0.456 * 100;
cout.setf(ios::fixed);
cout.precision(3);
cout << sum << 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!
Learn more about our help with Assignments:
C++
Comments
Leave a comment