Answer to Question #277333 in C++ for May

Question #277333

Print out the square root of a given integer with only two decimal places.


1
Expert's answer
2021-12-08T16:29:47-0500
#include <iostream>
#include <math.h>  
#include <iomanip>


int main()
{
	double value = 0.0;
	std::cout << "Enter value: ";
	std::cin >> value;
	double result = sqrt(value);


	std::cout << std::fixed;
	std::cout << std::setprecision(2);
	std::cout << "Square root is: " << result << std::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 the first!

Leave a comment

LATEST TUTORIALS
New on Blog