Skip to content
Home » C++ Programs » Square Root in C++ With SQRT

Square Root in C++ With SQRT

Square Root in C++ With SQRT. The cmath header file in C++ provides a set of functions for performing mathematical operations, such as sqrt() for calculating the square root, log() for finding the natural logarithm of a number, and so on.

math.h Header File in C++

You must include the header files math. h> and cmath> in order to utilise these functions. sin(double) double sin(double) sin(double) sin(double) sin(double).

This function accepts an angle (in degrees) and returns its sine value, which can be confirmed using a sine curve. h is a header file in the C programming language’s standard library that is used to perform fundamental mathematical calculations. Integer-operating mathematical library functions, such as abs, labs, div, and ldiv, are instead supplied in the stdlib.

SQRT Function in C++

One of the math and trigonometry functions is the SQRT function. It’s used to calculate a number’s square root. where x is a numeric value explicitly inputted or contained in the cell you’re referring to.

Square Root in C++ With SQRT

using namespace std;
int main()
float num, root;
cout << "Enter the num for sqrt";
cin >> num;
root = sqrt(num);
cout << "Square root of " << num << " is " << root;
return 0;


Enter the num for sqrt1500
Square root of 1500 is 38.7298