Arithmetic Operators
Arithmetic Operators are operators that performs basic operations like addition, subtraction, multiplication, division, and modolus.
i. Addition
+
operator :Adds values on either sides of the operater. For Example:
Consider A=20 and B=10 A+B would be 30
ii. Subtraction
-
operator:Subtract right hand operand from left hand operand. For Example:
Consider A=20 and B=10 A-B would be 10
iii. Multiplication
*
operator:Multiply values on either sides of the operator. For example:
Consider A=20 and B=10 A*B would be 200
iv. Division
/
operator:Divides left hand operand by right hand operator. For example:
Consider A=20 and B=10 A/B would be 2
v. Modulus
%
operator:Divides left hand operand by right hand operator and returns the remainder. For example:
Consider A=20 and B=10 A%B would be 0
Program example of arithmetic operators
//An example of arithmetic operators
#include<stdio.h>
int main()
{
int A = 20, B= 10;
printf("Consider A = %d and B = %d \n",A,B);
printf("Addition operator (A+B) = %d \n",A+B);
printf("Subtraction operator (A-B) = %d \n",A-B);
printf("Multiplication operator (A*B) = %d \n",A*B);
printf("Division operator (A/B) = %d \n",A/B);
return 0;
}
Output
Consider A = 20 and B = 10
Addition operator (A+B) = 30
Subtraction operator (A-B) = 10
Multiplication operator (A*B) = 200
Division operator (A/B) = 2