Arithmetic Operator in COperators are the special symbols in the C programming language, which is used to perform various mathematical and logical operations on the given operands to return the appropriate results. There are various operators in the C programming language such as Arithmetic Operators, Relational Operators, Shift Operators, Logical Operators, Bitwise Operators, Ternary or Conditional Operators, and Assignment Operators. But here, we will understand only the Arithmetic Operator in the C programming language. ![]() Arithmetic Operator is used to performing mathematical operations such as addition, subtraction, multiplication, division, modulus, etc., on the given operands. For example: 5 + 3 = 8, 5 - 3 = 2, 2 * 4 = 8, etc. are the examples of arithmetic operators. Let's discuss the different types of Arithmetic Operators in the C programming. Plus OperatorIt is a simple Plus (+) Operator used to add two given operands. We can use Plus Operator with different data types such as integer, float, long, double, enumerated and string type data to add the given operand. Syntax For example, there are two operands, 5 and 6, and we want to get the sum of these numbers. Therefore, we use the '+' Operator between the given numbers that return integer data 11. Program1.c Output Enter two integer numbers: 25 35 Enter two float numbers: 79.21 67.79 Enter two double data type numbers: 234.123 345.341 The sum of two integer numbers: 60 The sum of two float numbers: 147.000000 The sum of two double numbers: 579.464000 Minus OperatorThe minus operator is denoted by the minus (-) symbol. It is used to return the subtraction of the first number from the second number. The data type of the given number can be different types, such as int, float, double, long double, etc., in the programing language. Syntax For example, there are two operands, 15 and 6, and we want their subtraction result. So, we use the '-' Operator between the given numbers that return data 9. Program2.c Output Enter two integer numbers: 56 11 Enter two float numbers: 78.98 56.45 Enter two double data type numbers: 47789.7149 1234.7987 The subtraction of two integer numbers: 45 The subtraction of two float numbers: 22.530003 The subtraction of two double numbers: 46554.916200 Multiplication OperatorThe multiplication operator is represented as an asterisk (*) symbol, and it is used to return the product of n1 and n2 numbers. The data type of the given number can be different types such as int, float, and double in the C programing language. Syntax For example, there are two operands 15 and 6, and we want to get their product. So, we can use the '*' Operator between the given numbers that return int data 90. Program3.c Output Enter two integer numbers: 15 12 Enter two float numbers: 2.5 3.5 Enter two double data type numbers: 234.324 798.124 The multiplication of two integer numbers: 180 The multiplication of two float numbers: 8.750000 The multiplication of two double numbers: 187019.608176 Division OperatorThe division operator is an arithmetic operator that divides the first (n1) by the second (n2) number. Using division operator (/), we can divide the int, float, double and long data types variables. Syntax For example, there are two operands, 25.5 and 5.0, and we want to get their division result. So, we use the '/' Operator between the given numbers that return float data 5.1. Program4.c Output Enter two integer numbers: 125 15 Enter two float numbers: 214.32 248.56 Enter two double data type numbers: 4243.7691 687.434 The division of two integer numbers: 8 The division of two float numbers: 0.862247 The division of two double numbers: 6.173348 Modulus OperatorThe modulus operator is represented by the percentage sign (%), and it is used to return the remainder by dividing the first number by the second number. Syntax For example, there are two operands 25 and 4, and we want to get their modulus result. So, we use the '%' operator in between the given numbers that return remainder 1. Program5.c Output Enter two integer numbers: 35 3 The modulus of two integer numbers: 2 Increment OperatorIncrement Operator is the type of Arithmetic operator, which is denoted by double plus (++) operator. It is used to increase the integer value by 1. Syntax For example, suppose the integer value of A is 10, the increment operator increases the operand value by 1, which returns 11. Program6.c Output Enter the positive number: 10 The incremented value is: 11 Decrement OperatorDecrement Operator is denoted by the double minus (--) symbol, which decreases the operand value by 1. Syntax For example, suppose the integer value of A is 10, the decrement operator decreases the operand value by 1 that returns 9. Program7.c Output Enter the positive number: 10 The decremented value is: 9 Next TopicCeil Function in C |