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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a Program to find the largest of 4 no using macros.

584


Give an example of run-time polymorphism/virtual functions.

568


Define pre-condition and post-condition to a member function in c++?

667


How do you import payscale data from non SAP to SAP?is it through LSMW or any other way is there?

3205


When is dynamic checking necessary?

604






What is a tree in c++?

565


What is the stl, standard template library?

600


What is the identity function in c++? How is it useful?

553


C++ supports multiple inheritance. What is the “diamond problem” that can occur with multiple inheritance? Give an example.

394


What is c++ & why it is used?

592


What is the iunknown interface?

683


Define a constructor - what it is and how it might be called (2 methods)?

606


How would perform Pattern Matching in C++?

658


any one please tell me the purpose of operator overloading

1967


Can I learn c++ without learning c?

564