how to use square in c++ code example
Example 1: square c++
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double x = 10.25, result;
result = sqrt(x);
cout << "Square root of " << x << " is " << result << endl;
return 0;
}
Example 2: square root c++
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
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;
}