Overview
Arithmetic operators are used to perform calculations on numerical values, as well as to concatenate two or more string values.
The following is a list of Arithmetic Operators:
+ (Addition) : To add numerical values and to concatenate string values. Example:
- a=5;
- b=5;
- c=a+b; // c= 10
- First_Name="John";
- Last_Name="Smith";
- Name = First_Name + " " + Last_Name; // Name = John Smith
- (Subtraction) : To perform subtraction between numerical values.Example:
- a=5;
- b=5;
- c=a-b; // c= 0
* (Multiplication) : To perform multiplication of numerical values.Example:
- a=5;
- b=5;
- c=a*b; // c= 25
/ (Division) : To perform division of numerical values.Example:
- a=5;
- b=5;
- c=a/b; // c= 1
% (Modulus) : To calculate the remainder when a numerical value is divided by another.Example:
- a=5;
- b=5;
- c=a%b; // c= 0
Data types applicable to Arithmetic Operators
- Number
- Decimal
- String (only for 'Addition' operator)
- Date-Time (only for 'Addition' and 'Subtraction' operators)