Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 9

Numeric Literals

int (signed integers) : Negative or Positive whole


numbers

float (floating point real values) : Numbers having


decimal point

complex (complex numbers) : Numbers having real and


imaginary part
Integer Literals
Must have at least one digit
Must not contain decimal point
May contain a positive or negative sign
Commas can not appear in it

Types of integer literals


(i) Decimal integer literals : starting with non zero
(ii) Octal integer literals : starting with 0o
(iii) Hexa Decimal integer literals : starting with 0X or 0x
Floating Point Literals :
(i) Fractional form : at least one digit with a decimal
point before or after.
(ii) Exponent form : containing two parts Mantissa
and Exponent, separated by E
The Mantissa part must be either an integer or a
real constant. The Exponent part must be an
integer.
Boolean Literals :
Represent the values True and False
Operators :

Operators are the symbols which represent some


predefined operations on constants, variables or
objects (Operands)

Categories of Operators :

(i) Unary Operators : Require only one operand

(ii) Binary Operators : Require two operands


Categories of Operators :
(i) Arithmetic Operators
+ Addition - Subtraction
* Multiplication / Division
% Modulus ** Exponent
// Floor division

(ii) Bitwise Operators


& Bitwise AND
^ Bitwise exclusive or (XOR)
| Bitwise OR

(iii) Shift Operators


<< Left shift
>> Right shift
(iv) Identity Operators
is is the identity same
is not is the identity not same

(v) Relational Operators


< Less than > greater than
== Equal to >= greater than equal to
<= Less than equal to
!= Not equal to

(vi) Assignment Operators


= Assignment += Assign Sum
-= Assign difference *= Assign Product
/= Assign quotient %= Assign remainder
**= Assign Exponent //= Assign Floor Div
(vii) Logical Operators
and Logical AND
or Logical OR

(viii) Membership Operators


in Whether variable in sequence
not in Whether variable not in sequence
Punctuators :

These are the symbols that are used to organize


sentence structures in a program.

‘ “ # \ () [] {} @ , : . ` =

You might also like