Arithmetic Operators in C Language


Arithmetic Operators in C Language:

    • C Arithmetic operators are used to perform mathematical calculations like addition, subtraction, multiplication, division and modulus in C programs.
S.no
Arithmetic Operators
Operation
Example
1
+
Addition
A+B
2
-
Subtraction
A-B
3
*
multiplication
A*B
4
/
Division
A/B
5
%
Modulus
A%B

Example program for C language arithmetic operators:

    • In this example program, two values “40″ and “20″ are used to perform arithmetic operations such as addition, subtraction, multiplication, division, modulus and output is displayed for each operation.

Output:

Addition of a, b is : 60
Subtraction of a, b is : 20
Multiplication of a, b is : 800
Division of a, b is : 2
Modulus of a, b is : 0



 Continue on types of C language operators:

S.no
Types of Operators
             Description              
1
Arithmetic_operatorsThese are used to perform mathematical calculations like addition, subtraction, multiplication, division and modulus
2
Assignment operatorsThese are used to assign the values for the variables in C programs.
3
Relational operatorsThese operators are used to compare the value of two variables.
4
Logical operatorsThese operators are used to perform logical operations on the given two variables.
5
Bit wise operatorsThese operators are used to perform bit operations on given two variables.
6
Conditional (ternary) operatorsConditional operators return one value if condition is true and returns another value is condition is false.
7
Increment / decrement operatorsThese operators are used to either increase or decrease the value of the variable by one.
8
Special operators&, *, sizeof( ) and ternary operators.
www.cinterviews.com appreciates your contribution please mail us the questions you have to cinterviews.blogspot.com@gmail.com so that it will be useful to our job search community.

No comments: