Q1: Define Operators. Discuss various types of Operators in C- program?
Ans: OPERATORS:
Operators are special symbols used for specific operators' purposes.There are seven types of operators that are used in ( C ) C++programing
1- Arithmetic Operators
2- Increment Operators
3- Decrement Operators
4- Relational Operators
5- Logical Operators
6- Assignment Operators
7- Arithmetic Assignment Operators (IDEAL COLLEGIATE)
1. ARITHMETIC OPERATORS
Arithmetic operators. i,e Addition(+) ,Subtraction(-), Multiplication(*),
Division(/), Remainder/Module (%).
2. INCREMENT OPERATORS
1 to the value of a variable.i,e prefix ++a, postfix a++.
(IDEAL COLLEGIATE)
3. DECREMENT OPERATORS
4. RELATIONAL OPERATOR
The relational operators are used to test the relation between two values.
OPERATORS |
MEANING |
EXPRESSION |
= = |
Equal to |
a= =b |
! = |
Not equal to |
a ! = b |
> |
Greater Than |
a > b |
< |
Less Than |
a < b |
>= |
Greater Than Or Equal To |
a >= b |
<= |
Less Than Or Equal To |
a <= b |
5. LOGICAL OPERATORS:
Operators |
Description |
Expression |
&& |
This Operator is Called AND. |
x=10, y=5, z=12,x>y &&
x<z |
| | |
It’s known as OR operator. |
x=10, y=5, z=12 x>y | | x>z |
! |
This operator is called NOT |
x=10, y=5, ! (x<y) |
6. ASSIGNMENT OPERATORS:
7. ARITHMETIC ASSIGNMENT OPERATORS:
In arithmetic assignment operators, the arithmetic operator is combined with the assignment operator. The assignment operator comes to the right of an arithmetic operator. This operator is also known as a compound Assignment operator. (IDEAL COLLEGIATE)
Operators Description +=(Addition-assignment) It adds the right operand to the left operand and assigns
the result to the left operand. Example: a+=2 means a=a+2 -=(Subtraction-assignment) It subtracts the right operand from the left operand and
assigns the to the left operand. Example:a-=3 means a=a-3 *=(Multiplication-assignment) It multiplies right operand with the left operand and
assigns the result to the left operand Example:a*=4 means a=a*4 /=(Division-assignment) It divides the left operand with the right operand and assigns
the result to the left operand Example:a/=4 means a=a/4
No comments:
Post a Comment