• Register
search
Log In

A square root of a number is a value that, when multiplied by itself, gives the number. In others words finding the square root of a number is the inverse operation of squaring that number. Remember, the square of a number is that number times itself.

 

Sqrt (square root)

The function sqrt returns the square root of the integer inside the parameter list. This method to find the square root requires integer value as input finds square root and returns integer as output.

Example

#include <iostream>
#include <math.h>
using namespace std;
int main(){
   double a =25 ;
   cout << "sqrt( "<<a<<" ) = " << sqrt(a) << endl;
}

Output 

sqrt( 25 ) = 5.00
Note : For using this function don’t forget to use the header file math.h
posted Jun 20 in c++ 100 points