The function sqrt() calculates the square root of a number.
Use the following function to find the square root of a given number:
sqrt(x)
The function admits the following parameter:
x: the number to find the square root of. Allowed data types: any data type.
The function returns the input number’s square root. Data type: double.
Calculate the square root of the x variable:
float x = 9.0;
void setup() {
Serial.begin(9600);
double root = sqrt(x);
Serial.print("The square root is: ");
Serial.println(root);
}
void loop() {
}