Education logo

ARITHMETIC OPERATORS IN C

#100DaysOfCodeChallenge

By Preethi SivaPublished 4 years ago 3 min read
Image credit : Bing pictures

Operators in C language plays a decisive role in determining the operation that needs to be performed. Basically, an operator is a symbol used in C program that specifies the mathematical, relational and logical operations that is to be carried out on an operand. An operand can be variable or a constant on which an operator works and together forms an expression. The operators on the whole is divided into 10 different categories. The types are as follows :

1. Arithmetic operators

2. Relational operators

3. Logical operators

4. Unary operators

5. Equality operators

6. Conditional operators

7. Bitwise operators

8. Comma operators

9. Assignment operators

10. Sizeof operator

Firstly, let's look in for Arithmetic Operators. Arithmetic operators work on integer and floating point datatypes. There are various arithmetic operators are listed out below along with their respective syntax. For clear understanding, an example is also annexed.

1. ADDITION OPERATOR :

>>Represented by the symbol '+'.

 >>Executes addition operation on the operands i.e., adds two values

>>SYNTAX : 

 operand + operand

 >>EXAMPLE : 

Let us consider two variables a and b. 

sum = a + b

If a=5 and b=3

sum = 8

2. SUBTRACTION OPERATOR :

>>Represented by the symbol ' - '.

>>Executes subtraction operation on the operands i.e., minus two values

 >>SYNTAX : 

 operand  -  operand

 >>EXAMPLE : 

Let us consider two variables a and b. 

difference = a - b

If a=5 and b=3

difference = 2

3. MULTIPLICATION OPERATOR :

>>Represented by the symbol ' *'.

>>Executes multiplication operation on the operands i.e., multiplies two values

 >>SYNTAX : 

 operand * operand

 >>EXAMPLE : 

Let us consider two variables a and b. 

product = a *b

If a=5 and b=3

product = 15

4. DIVISION OPERATOR :

>>Represented by the symbol ' /'.

>>Executes division operation on the operands i.e., divides two values

 >>SYNTAX : 

 operand / operand

>>This operator returns the quotient value. It works on both integer and floating point datatypes. If we declare it as integer, our returning value as output will be an integer with neglecting the decimal places. 

For example,

5/2=4 (integer declaration)

5/2=4.5000 (floating point declaration)

>>EXAMPLE : 

Let us consider two variables a and b. 

quotient = a/b

If a=15 and b=3

quotient = 5

5. MODULUS OPERATOR :

>>Represented by the symbol ' %'.

>>Executes modulus operation on the operands.

>>It performs normal division operation on the operands but it returns the remainder as the output. 

>>The noteworthy point is that this modulus function does not work on floating point datatypes. It can perform its function only on integer datatype.

>>SYNTAX 

 operand % operand

 >>EXAMPLE : 

Let us consider two variables a and b. 

remainder = a%b

If a=10 and b=2

remainder = 0

The sign conventions in an arithmetic operator, that too in division and modulus operator is an essential terminology to be known for good programming skills.

Initially lets begin with modulo division. The sign of the result of this operation depends on the sign of the first operand.

17 % 2 = 1

17 % -2 = 1

-17 % 2 = -1

-17 % -2 = -1

The case is not same with division operator. The sign of a division operator does not depend on the sign of first operator. Else it depends on the sign of both the operators.

9 / 2 = 4

-9 / 2 = -4

9 / -2 = -4

-9 / -2 = 4

From the above, we can conclude that, if the two operands are integers and quotient is not an integer, then

1. If the two operands have same sign, then the displayed quotient is lesser than the true quotient.

2. If the two operands have opposite signs, then the displayed quotient is greater than the true quotient.

With this the topic of arithmetic operators is complete.

Have a great day friends!!

Thank you!!

courses

About the Creator

Preethi Siva

Writing is not my hobby.........

It comes when my heart is connected to my soul and says to write!!!

Reader insights

Be the first to share your insights about this piece.

How does it work?

Add your insights

Comments

There are no comments for this story

Be the first to respond and start the conversation.

Sign in to comment

    Find us on social media

    Miscellaneous links

    • Explore
    • Contact
    • Privacy Policy
    • Terms of Use
    • Support

    © 2026 Creatd, Inc. All Rights Reserved.