Arduino Programming Language: Arithmetic

Name

Arithmetic Operators

Description

These operators return the sum, difference, product, or quotient (respectively) of the two operands. The operation is conducted using the data type of the operands. If the operands are of different types, the "larger" type is used for the calculation.

Syntax

//variables or constants
sum=var1+var2; //sum
sub=var1-var2; //difference
mul=var1*var2; //product
div=var1/var2 //quotient

Parameters

  • var: any type of data, variable or costant

Usage

Application

Examples

sum=5+3;
sub=sum-2;
x=x*6;
y=sub/4;

Related Functions


Based on the reference originally written by Arduino Community,  wiring.org.co and  arduino.cc