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

How the virtual functions maintain the call up?

581


Are polymorphisms mutations?

677


Can we have inheritance without polymorphism?

594


What is a function in oop?

600


What is ios flag in c++?

655






Write some differences between an external iterator and an internal iterator?

548


What is a singleton c++?

519


Is it possible to use a new for the reallocation of pointers ?

568


How Do you Code Composition and Aggregation in C++ ?

24141


Will a C compiler always compile C++ code a) Yes b) No c) Only optimized compilers

588


What are the two shift operators and what are their functions?

537


Why is polymorphism needed?

564


How can you quickly find the number of elements stored in a static array?

614


What operators can you overload in c++?

560


What do you mean by abstraction?

587