TypeScript - Arithmetic Operators Examples - TypeScript

What are examples of Arithmetic Operators?

Let the values in variables a and b are 10 and 5 respectively.

Operator Description Example
+ (Addition) returns the sum of the operands a + b is 15
- (Subtraction) returns the difference of the values a - b is 5
* (Multiplication) returns the product of the values a * b is 50
/ (Division) performs a division operation and returns the quotient a / b is 2
% (Modulus) performs a division and returns the remainder a % b is 0
++ (Increment) Increments the value of the variable by one a++ is 11
-- (Decrement) Decrements the value of the variable by one a-- is 9

Example

The following JavaScript code is generated on compiling the above code.

The output of the above program is as follows:

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

TypeScript Topics