Professional Documents
Culture Documents
Character type
Constants and Variables
A constant is a value that cannot be altered by the program
during normal execution, i.e., the value is constant. When
associated with an identifier, a constant is said to be “named,”
although the terms “constant” and “named constant” are often
used interchangeably. This is contrasted with a variable, which is
an identifier with a value that can be changed during normal
execution, i.e., the value is variable.
Arithmetic Operators
- The basic arithmetic operations are addition, subtraction,
multiplication, and division. Arithmetic is performed according to
an order of operations.
Types of Operators
Integer Arithmetic
- When an arithmetic operation is performed on two whole
numbers or integers than such an operation is called as integer
arithmetic. It always gives an integer as the result. Let x = 2
and y = 2 be two integer numbers.
x + y = 4;
x - y = 0;
x * y = 4;
x % y = 0;
x / y = 1;
Types of Operators
Relational Operators
- Often it is required to compare the relationship between
operands and bring out a decision and program accordingly.
This is when the relational operator comes into picture.
Types of Operators
Logical Operators
- A logical operator is a symbol or word used to connect two
or more expressions such that the value of the compound
expression produced depends only on that of the original
expressions and on the meaning of the operator. Common logical
operators include AND, OR, and NOT.
Types of Operators
Assignment Operators
- Assignment operators are used to assign values to variables.