sq()
Description
Calculates the square of a number: the number multiplied by itself.
Syntax
sq(x)
Parameter Values
- x: the number. Allowed data types: any data type.
Return Values
- The square of the number. Data type: double.
Example Code
The result in Serial Monitor:
※ NOTES AND WARNINGS:
Because of the way the sq() function is implemented, avoid using other functions inside the brackets, it may lead to incorrect results.
This code will yield incorrect results:
Use this instead:
See Also
※ ARDUINO BUY RECOMMENDATION
Arduino UNO R3 | |
Arduino Starter Kit |