Page 20 - PlusGPT_V2.1_C8_Flipbook
P. 20
Arithmetic Operators
Arithmetic operators perform arithmetic operations between two operands. The arithmetic operators
are defined in the following table:
Operator Name Description Example Output
(x=7 and y=3)
+ Addition Adds values on either side of the operator. x + y 10
– Subtraction Subtracts the right-hand operand from the x – y 4
left-hand operand.
* Multiplication Multiplies values on either side of the operator. x * y 21
/ Division Divides left-hand operand by right-hand x / y 3
operand.
% Modulus Divides left-hand operand by right-hand x % y 1
operand and returns the remainder.
** Exponentiation Performs exponential (power) calculation on x ** y 343
operands.
// Floor or Integer Divides and cuts the fractional part from the x // y 2
division result.
Program 1: To perform all the arithmetic operations.
The result of the above program is:
18 Premium Edition-VIII

