Math Operators โœ–๏ธ#

C supports the addition, subtraction, multiplication, and division operations from math. Hereโ€™s a list of operators and example usage.

Name

Symbol

Description

Example

Addition

+

Adds two numbers together

50 + 10

Subtraction

-

Adds two numbers together

50 - 10

Multiplication

*

Multiplies two numbers together

50 * 10

Division

/

Divides the first number by the second number

50 / 10

Caution

Just like in regular math, you cannot divide by zero. If you do then your program may behave unexpectedly!


Tasks ๐ŸŽฏ#

What does 5 * 2 evaluate to?

Solution โœ…

5 * 2 = 10

What does 5 / 0 evaluate to?

Solution โœ…

This isnโ€™t defined, because you cannot divide by zero.