Answer to Question #316450 in C++ for chin

Question #316450

You've learned in the past lessons on how to use square root functions, right? Then let's take your knowledge to the test. Print out the square root of a given integer with only two decimal places.





Ready, solve, and go!





Input





A line containing an integer.





4





Output





A line containing a decimal with two decimal places.





2.00




1
Expert's answer
2022-03-23T13:45:19-0400




#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;


int main(void){
	int n;
	cin>>n;


	double sqrtn=sqrt(n*1.0);


	cout<<fixed<<setprecision(2)<<sqrtn<<"\n\n";


	
	system("pause");
	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