Write a C++ Program to find Square Root of a number using sqrt() function.



Write a C++ Program to find Square Root of a number using sqrt() function...

Answer / hr

Solution:
/* C++ Program to find Square Root of a number using sqrt() function */
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
float sq,n;
cout<<"Enter any positive number :: ";
cin>>n;
sq=sqrt(n);
cout<<"
Square root of Entered Number [ "<<n<<" ] is :: "<<sq<<"
";
return 0;
}
Output:
/* C++ Program to find SquareRoot of a number using sqrt() function */
Enter any positive number :: 10000
Square root of Entered Number [ 10000 ] is :: 100
Process returned 0

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ Interview Questions

Name the operators that cannot be overloaded.

1 Answers   Wipro,


Tell us the size of a float variable.

0 Answers   Accenture,


How to convert integer to string in C++

0 Answers  


What is wrong with this statement? std::auto_ptr ptr(new char[10]);

0 Answers   Amazon,


What are the major differences between C and C++?

0 Answers   Amazon,






Can we call C++ OOPS? and Why

0 Answers  


How to stop class inheritance in C++ with condition that object creation should be allowed

0 Answers  


What are the different scope C++ provide ?

0 Answers   Amdocs,


When must you use a constructor initializer list?

0 Answers   Amazon,


What is an algorithm (in terms of the STL/C++ standard library)?

0 Answers   Amazon,


Can we call a virtual function from a constructor?

1 Answers  


What are the advantages/disadvantages of using inline and const?

0 Answers   Amazon,


Categories