C Tutorial Mathematical operators
Introduction to C language
Integer types
Char constants
Int constants
Type combination and promotion
Int overflow
Floating point types
Comments
Variables
Assignment operator
Truncation
Int vs float arithmatic
Mathematical operators
Unary Increment Operators
Pre and Post Variations
C Programming Cleverness and Ego Issues
Relational Operators
Logical Operators
Bitwise Operators
Other Assignment Operators

 

 
 
 
 

 

HOME
 

Mathematical Operators

C includes the usual binary and unary arithmetic operators. See the appendix for the table

of precedence. Personally, I just use parenthesis liberally to avoid any bugs due to a

misunderstanding of precedence. The operators are sensitive to the type of the operands.

So division (/) with two integer arguments will do integer division. If either argument is

a float, it does floating point division. So (6/4) evaluates to 1 while (6/4.0)

evaluates to 1.5 -- the 6 is promoted to 6.0 before the division.

 

+    Addition

 

- Subtraction

 

/ Division

 

* Multiplication

 

% Remainder (mod)

Want more information and Video ???