## 2017년 3월 27일 월요일

### Arduino Arithmetic Operators

This week on Adventures in Science, we look at the various arithmetic operators in C and C++, specifically, as they're used in the Arduino environment. There are only 6 main operators: assignment, addition, subtraction, multiplication, division, and modulo. We also look at compound assignment operators; how they can be used to perform a math operation on a variable and then store the result back in the same variable.

Language Reference:
Arduino programs can be divided in three main parts: structurevalues (variables and constants), and functions.

### Structure

#### Arithmetic Operators

• = (assignment operator)
• - (subtraction)
• * (multiplication)
• / (division)
• % (modulo)

#### Comparison Operators

• == (equal to)
• != (not equal to)
• < (less than)
• > (greater than)
• <= (less than or equal to)
• >= (greater than or equal to)

• && (and)
• || (or)
• ! (not)

#### Bitwise Operators

• & (bitwise and)
• | (bitwise or)
• ^ (bitwise xor)
• ~ (bitwise not)
• << (bitshift left)
• >> (bitshift right)

#### Compound Operators

• ++ (increment)
• -- (decrement)
• -= (compound subtraction)
• *= (compound multiplication)
• /= (compound division)
• %= (compound modulo)
• &= (compound bitwise and)
• |= (compound bitwise or)

### Functions

#### Looking for something else?

See the libraries page for interfacing with particular types of hardware. Try the list of community-contributed code. The Arduino language is based on C/C++. It links against AVR Libc and allows the use of any of its functions; see its user manualfor details.