Square Root Program in C++

C++ program to print the square root. 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.

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

What is math.h and how to implement in c++ program

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.

What is SQRT function program 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.

Similar Programs