A square root of a number n is a number which, when multiplied by itself, gives n as an output. Let’s say 2×2 = 4, according to this example, 2 is the square root of 4. So if you want to learn how to calculate the square root of a number using the **C++** programming language, then this article is for you. In this article, I will present a tutorial on how to calculate square root using C++.

## Square Root using C++

The output we get after multiplying a number by itself is known as the square of the number and the number we multiplied by itself to find the square is nothing but the square root of the number. For example, if 2×2 = 4 then 2 is the square root of 4. Hope you now understand what the square root of a number is, now below is how you can easily calculate the square root of a number by using the C++ programming language:

In the above code, I have first introduced a variable as x = 20, and then in the next line of the above code, we are calculating the square root of 20 by using the sqrt function provided by the cmath library. Once you will run this code you will get to see 4 as an output.

### Summary

So this is how you can calculate the square root of a number. The output we get after multiplying a number by itself is known as the square of the number and the number we multiplied by itself to find the square is nothing but the square root of the number. I hope you liked this article on how to calculate the square root of a number by using the C++ programming language. Feel free to ask your valuable questions in the comments section below.