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 |
When would you choose to return an error code rather than throw an exception?
How to reverse a string in C++
It is possible to build a C++ compiler on top of a C compiler. How would you do this?
Write a program to generate the Fibonocci Series in C++.
Find the Factorial of a number using a program.
Explain encapsulation in C++.
What is a class in C++?
1 Answers Amazon, TCS, UGC Corporation,
Write a C++ Program to Display Number (Entered by the User).
What does it mean to take the address of a reference?
Explain the FOR loop with a help of a code.
What is the meaning of the following declaration: int *const *const *i?
Factory Method C++ – How to delete pointers returned by it