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

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

0 Answers  


How to generate random numbers in C++ with a range?

0 Answers  


Can we provide one default constructor for our class?

0 Answers  


What do you know about Volatile keyword in C++? Explain with an example code.

0 Answers   Adobe,


What kind of problems does name mangling cause?

0 Answers   Amazon,






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

3 Answers   HFG, Siemens,


What are the advantages and disadvantages of B-star trees over Binary trees?

0 Answers  


Write a C++ Program to Find whether given Number is Odd or Even.

1 Answers  


What are the different scope C++ provide ?

0 Answers   Amdocs,


What is pass by value & reference.

0 Answers   Accenture,


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

0 Answers   Alter,


Difference between function overloading and function overriding.

0 Answers   Alter,


Categories