square root in cpp code example
Example 1: sqrt in c++
sqrt(x);
Example 2: sqrt cpp
int main(){
int a = 2;
int sqrtNum = sqrt (a);
cout << sqrtNum << endl;
return 0;
}
Example 3: square root c++
int main(){
float num, raiz;
printf("enter a number: \t");
scanf("%f",&num);
raiz = sqrt(num);
printf("The square root of %f is: %f.\n", num, raiz);
system("pause");
return 0;
}
Example 4: sqrt() function in c++
using namespace std;
int main()
{
double x = 10.25, result;
result = sqrt(x);
cout << "Square root of " << x << " is " << result << endl;
return 0;
}
Example 5: sqrt c++