0% found this document useful (0 votes)
7 views

19. Arithmetic Operator

The document outlines various operators and expressions in the C programming language, categorizing them into arithmetic, relational, logical, and other types. It details the basic arithmetic operators and provides examples of their usage. Additionally, it introduces library functions for standard mathematical operations, including their corresponding C functions and meanings.

Uploaded by

BRIJESH KR SINGH
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

19. Arithmetic Operator

The document outlines various operators and expressions in the C programming language, categorizing them into arithmetic, relational, logical, and other types. It details the basic arithmetic operators and provides examples of their usage. Additionally, it introduces library functions for standard mathematical operations, including their corresponding C functions and meanings.

Uploaded by

BRIJESH KR SINGH
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Operators and Expressions

An expression consists of variables and constants separated by operators. C


language uses many type of operators as listed below:-
1. Arithmetic Operators
2. Relational Operators
3. Logical Operators
4. Increment and Decrement Operators
5. Assignment Operators
6. Conditional Operators
7. Bitwise Operators
Arithmetic Operators
The basic arithmetic operators in C are the same as in most other computer
languages, and correspond to our usual mathematical/algebraic symbolism.
The following arithmetic operators are present in C:

Operators Meaning Example Result


+ Addition 4+2 6
- Subtraction 4-2 2
* Multiplication 4*2 8
/ Division 4/2 2
Modulus operator to get
% remainder in integer 5%2 1
division
Library Functions
To perform standard mathematical operations such as square root,
absolute value and so on, built-in programs called library
functions are available with the compiler. These functions can be
used in an expression by mentioning their names with required
number of arguments in parenthesis.
The complier directive #include<math.h> is used to include any
of these functions in a C program.
Library Functions (Intrinsic functions or Math Functions)
Mathematical Notation C Function Meaning

𝑎 sqrt (a) Square root of a


𝑎 fabs (a) Absolute value of a
𝑒𝑥 exp (𝑥) Exponential of 𝑥
log 𝑥 log (𝑥) Logarithm of 𝑥
𝑥𝑦 pow (𝑥, 𝑦) 𝑥 raised to y
sin 𝑥 sin (𝑥) Sine of 𝑥 (𝑥 in radians)
cos 𝑥 cos (𝑥) Cosine of 𝑥 (𝑥 in radians)
tan 𝑥 tan (𝑥) Tangent of 𝑥 (𝑥 in radians)
ceil (𝑥) Round off a float value to the nearest integer upward
(e.g. 5.34 will be rounded off to 6.0)

floor (𝑥) Rounded off a float value to the nearest integer


downwards (e.g. 5.34 will be rounded off to 5.0)

You might also like