# Square Root Program in C++

Written by

**Square Root of Number program in C++**

**# Important Points:**

- Square root in C++ can be calculated using
**sqrt()**function defined in <**math.h>**header file. **sqrt()**function takes a number as an argument and returns the square root of that number.

**Example:**

Given number: 1296

Square root: 36

**# Algorithm**

- Declare a variable called
`number`

to store the number whose cube root you want to calculate. - Declare a variable called
`root`

to store the result of the cube root calculation. - Prompt the user to enter the number whose cube root they want to calculate, and store the input in the
`number`

variable. - Use the
`sqrt()`

function from the`math`

library to calculate the cube root of the`number`

and store the result in the`root`

variable. - Print the result stored in the
`root`

variable to the console.

**Code:**

```
#include<iostream>
#include<math.h>
using namespace std;
int main(){
float number, root;
cout << "Enter number whose root is to be found: ";
cin >> number;
root = sqrt(number);
cout << "Square root of " << number << " is " << root;
return 0;
}
```

**Output**

```
Enter number whose root is to be found: 16
Square root of 16 is 4
```