Write a C++ Program to find Square Root of a number using sqrt() function.
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 |
What is the difference between creating an object, using 'new' and using 'malloc'?
What is a virtual base class?
What are Agilent PRECOMPILERS?
What is placement new?
What does it mean to declare a member function as static in C++?
Write a C++ Program to Find whether given Number is Odd or Even.
What are the advantages and disadvantages of B-star trees over Binary trees?
Define namespace.
When must you use a constructor initializer list?
Tell us the size of a float variable.
What is the difference between virtual functions and pure virtual functions?
What is static variable and difference between(const char *p,char const *p,const char* const p).