IT TECH IDEAL came to KARACHI, Pakistan in 2011, when the idea of professional schooling in IT was exclusively up-to learning of MS Word and Calculation sheets. IT TECH Schooling gave openness to Pakistani youth towards worldwide learning in IT training. Inside a limited capacity to focus time, it turned into the main IT preparing supplier of the country with its presence across Pakistan.

Full width home advertisement

Post Page Advertisement [Top]

 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

In arithmetic operators, five different operators are used to perform
Arithmetic operators. i,e Addition(+) ,Subtraction(-), Multiplication(*),
Division(/), Remainder/Module (%).


2. INCREMENT OPERATORS

The increment operators can be used with any type of variable 
1 to the value of a variable.i,e prefix ++a, postfix a++.
(IDEAL COLLEGIATE)

3. DECREMENT OPERATORS

The decrement operators are the same as increment operators but subtract from the value of a variable. It is represented by - i,e prefix - - a, postfix a- -(IDEAL COLLEGIATE)

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:

                        Logical Operators are used to determine two relational expressions There are three logical operators that are used in C programming.(IDEAL COLLEGIATE)

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:

The assignment operator (=) is used for assigning a variable to a value. These operators assign the value of the right-side expression to the left-side variable. such as x =10;(IDEAL COLLEGIATE)

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:

Bottom Ad [Post Page]