Addition is one of the four primary arithmetic operations. The operator + (plus) operates on two operands to produce the sum.
sum = operand1 + operand2;
- sum: variable. Allowed data types: int, float, double, byte, short, long.
- operand1: variable or constant. Allowed data types: int, float, double, byte, short, long.
- operand2: variable or constant. Allowed data types: int, float, double, byte, short, long.
※ NOTES AND WARNINGS:
- The addition operation can overflow if the result is larger than that which can be stored in the data type (e.g. adding 1 to an integer with the value 32,767 gives -32,768).
- If one of the numbers (operands) are of the type float or of type double, floating point math will be used for the calculation.
- If the operands are of float / double data type and the variable that stores the sum is an integer, then only the integral part is stored and the fractional part of the number is lost.
※ ARDUINO BUY RECOMMENDATION
|Arduino UNO R3 Buy on Amazon|
|Official Arduino Starter Kit Buy on Amazon|
|ELEGOO UNO R3 Starter Kit Buy on Amazon|