## Arithmetic Operators

**Objectives:**

To familiarize students with arithmetic, logical and relational operators

**Tools:**

Turbo C IDE

**Procedure:**

Writing a program that performs the following

• Receive two numbers as input from the user

• Find summation of two numbers using arithmetic operator

• Display on the screen to the user

Arithmetic operators are commonly used in a variety of programming languages. In C, there are five of them and they all take two

**OPERANDS –**an expression that is required for an operator to work. For example, for 2 + 3, 2 and 3 are considered as operands. The following table shows Arithmetic Operators:Operator Name | Symbol |

Multiplication | * |

Division | / |

Addition | + |

Subtraction | - |

Modulus | % |

In addition to the division operator, C also provides

**modulus operator (%)**which returns the**remainder**on dividing one integer with another. Thus the expression 10/2 yields 5, whereas 10%2 yields 0. Modulus operator cannot be applied on the float. Also using %, the sign of the remainder is always the same as the sign of numerator. Thus -5 % 2 yields -1, whereas 5 % -2 yields 1.**Step 1:**

**Create a New file and save it as operators.c**

**Step 2:**

Write the following code as shown in the figure below

**Figure 12 (a): Arithmetic Operator**

**Step 3:**

Save the file again, compile and execute it to see the output as shown in the figure below

**Figure 12 (b): Arithmetic Operator**

## 0 Comments