+ 4
Whats the function for finding the square root of a no.?
and what would be the header file that I should include with it?
7 Respuestas
+ 16
in sololearn use #include<cmath.h> as a header file
but if u are using turbo c++then use #include<math.h>
+ 5
https://www.programiz.com/cpp-programming/library-function/cmath/sqrt
Library: #include <cmath>
Function: sqrt(num)
ie:
double x = 25;
x = sqrt(x);
'x' is 5.0
+ 4
sqrt()
+ 1
you can use sqrt()
+ 1
what is the use of namspace std in c++ program
+ 1
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int num = 10;
cout << "Square Root of " << num << " is: "<< sqrt(num) << endl;
return 0;
}
Another student said this code doe no work. I ran this in SolLearn compiler without a problem.
Notice to run math functions you must have this statement:
#include <cmath>
0
sqrt() function will be usefull