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

What are Agilent PRECOMPILERS?

0 Answers   Agilent,


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

0 Answers   Amazon,


What is the difference between creating an object, using 'new' and using 'malloc'?

3 Answers   HFG, Siemens,


What does it mean to declare a function or variable as static?

0 Answers   Amazon,


How to invoke a C function using a C++ program?

0 Answers   Alter,


Factory Method C++ – How to delete pointers returned by it

0 Answers  


What do you by Function Overloading in C++?

0 Answers   Akamai Technologies, Infogain,


Explain why C++ is not purely Object Oriented Language

0 Answers   Aspire,


What does it mean to declare a member function as virtual in C++?

0 Answers   Amazon,


Explain the importance of method overloading in C++?

0 Answers   Akamai Technologies, Infogain,


What is constant keyword in C++? Illustrate its various uses.

0 Answers   Akamai Technologies, Infogain,


What is the 4 difference between delete[] and delete?

0 Answers   Alter,


Categories