What is the purpose of the sqrt function in C++?
The sqrt function in C++ is used to calculate the square root of a given number. This function is located in the header file and its prototype is as follows:
Calculate the square root of the input number x.
x is the number for which the square root is to be calculated. The sqrt function returns a floating point number representing the square root of the given number.
For example, sqrt(9) will return 3.0, and sqrt(2) will return 1.41421356, etc.