Currently Empty: $0.00
Introduction To Syllabus
0/3
Relation of Real Life and Programming
0/7
Stages of Programming
0/14
Dealing with Constructs
0/24
Question Set 3
0/3
Concept of Validations
0/6
Question Set 4
0/2
Arithmetic operators in programming are symbols or functions that perform mathematical operations on operands. These operators include addition (+), subtraction (-), multiplication (*), division (/), modulus (%), and exponentiation (**). Here’s how each operator works with examples:
Addition (+): Adds two operands(values)
a = 5
b = 3
result = a + b # result will be 8
Subtraction (-): Subtracts the right operand from the left operand.
a = 10
b = 4
result = a – b # result will be 6
Multiplication (*): Multiplies two operands.
a = 6
b = 7
result = a * b # result will be 42
Division (/): Divides the left operand by the right operand (results in a float).
a = 10
b = 3
result = a / b # result will be 3.3333333333333335
Modulus (%): Returns the remainder of the division of the left operand by the right operand.
a = 10
b = 3
result = a % b # result will be 1
Exponentiation ():** Raises the left operand to the power of the right operand.
a = 2
b = 3
result = a ** b # result will be 8
These arithmetic operators are fundamental in programming and are used extensively for performing mathematical calculations in various applications. It’s essential to understand their behavior and precedence rules when writing programs to ensure correct and efficient computation.