Page 67 - Digicode_AI_class_7
P. 67
Co-founders of Apple, Steve Jobs and Steve Wozniak, in their teenage began their
coding careers.
Performing Operations on Variables
Variable is a storage area, which defines the size, layout, range set of operations to be performed
on variable.
Once you declare the data types, you will learn to perform the operations on the data types.
Operator: It is a symbol which operates on a value assigned to a variable. Example: +,-, *, \.
Operand: It is a value on which the operator performed operation.
Arithmetic Operators
Arithmetic operation combines two or more numeric expressions by using the arithmetic operators.
The arithmetic operators perform operations such as: addition, subtraction, multiplication, division,
and modulus. In the table given below, we are taking, value of variable a= 10, and of b=30.
Operation Symbol Description Example
Addition + Adds one operand to the other a+b= 40
Subtraction - Subtracts second operand from the first a-b= 20
Multiplication * Multiplies one operand by the second a*b= 300
Division / Divides first operand by the second b/a= 3
Modulus % Divides the first operand by the second, and b%a= 0
returns the remainder
Increment ++ Increases the integer value by 1 a++ = 11
Decrement -- Decreases the integer value by 1 b-- = 29
Assignment operators
An assignment operator assigns a new value to a variable.
In the table given below, we are taking, value of variable a=10, and b=30.
Operator Symbol Description Example
Simple assignment = Assigns value to the left operand c = a + b (c = 10 + 30)
operator from right operand will assign the value of c to
a + b (c = 40)
More on MakeCode Arcade 65

