ans:

operator:- It is a symbol or a character used in programming. It is used to carry out some operation.

for example: +,-,= etc

It is of following types.

1)Arithmetic operator: It is used to do arithmetic calculations/operation.

It has following types.

+ -----------> used for addition.example is a+b. It means we are performing addition with the help of operand a and b

- ------------>It is used for subtraction.Example is a-b. It means we are performing subtraction with the help of operand a and b

* -------------------->used for multiplication.example is a*b. It means we are performing multiplication with the help of operand a and b

/---------------->used for division.example is a/b. It means we are performing division with the help of operand a and b

operator:- It is a symbol or a character used in programming. It is used to carry out some operation.

for example: +,-,= etc

It is of following types.

1)Arithmetic operator: It is used to do arithmetic calculations/operation.

It has following types.

+ -----------> used for addition.example is a+b. It means we are performing addition with the help of operand a and b

- ------------>It is used for subtraction.Example is a-b. It means we are performing subtraction with the help of operand a and b

* -------------------->used for multiplication.example is a*b. It means we are performing multiplication with the help of operand a and b

/---------------->used for division.example is a/b. It means we are performing division with the help of operand a and b

%---------------->used for remainder division.example is a%b. It means we are performing division with the help of operand a and b.It gives us remainder after division.

2)relational operator:

This operator is used to perform comparisons between variables.It supports us to take decision logically. example,x>y ,x>=y etc

Relational operator has following types.

>------> It is used to show greater than. like x>y

>=----->It is used to show greater than or equals to.like x>=y

<-------->It is used to show a variable is smaller than another.like x<y

<=-------> It is used to show smaller than or equals to with another variable.Like x<=y

!=----------> I simply says , two variables are not equal in value.like x!=y

==---------->It says two variables have same value.It is used to test values of two variables.

3)Logical operator:-

This operator is quite helpful when we want to combine multiple conditions and take decision.It returns values in the form of 0 o 1.It works logically.

Its types are:

3.a)and (&&)-----------> It is called 'and'operator.It is used to combine multiple conditions.It gives us true output if all of them are true otherwise we get false output.

example:if(a>b && a>c)

{

display a

}

we can see here that to be greatest,value of 'a' must be greater than b and c. So we use here '&&'

3.b)or(||):- It is called 'or'operator.It is used to combine multiple conditions.It gives us true output if anyone of them is true or all are true otherwise we get false output.

example:if(a==90 || b==90 || c==90)

{

display right angle triangle

}

we can see here that to be right angled triangle,either 'a'or 'b'or 'c' a must be 90 . So we use here '||'.

3.c) !(not )operator:-

It is used to reverse the result.

example

int a=5;

if(!(a==5))

{

printf("it is\n");

}

else

{

printf("it is not\n");

}

here ,the value is 5 but we get output "it is not".It is called reversing the output.

4) Assignment operator:

an operator ,symbolized by '=' character,is called assignment operator.It assigns value to variable.

example:

int a=6;

It means, we are assignming value 6 to variable a.

5)Unary operator:- this operator works on one operand only.It has two types.

I) increment operator:- It increases the value of given variable by one.For example: ++y or y++

It can be classified into pre-increment and post increment.

pre-increment:- It is written as ++x.It means first increase the value and then use that.

post-increment: It is written as x++.It means, first use that and then increase its value by one.

II)decrement operator:- It decreases the value of given variable by one.For example: --y or y--

It can be classified into pre-decrement and post decrement.

pre-decrement:- It is written as --x.It means first decrease the value and then use that.

post-decrement: It is written as x--.It means, first use that and then decrease its value by one.

example

int a=5;

if(!(a==5))

{

printf("it is\n");

}

else

{

printf("it is not\n");

}

here ,the value is 5 but we get output "it is not".It is called reversing the output.

4) Assignment operator:

an operator ,symbolized by '=' character,is called assignment operator.It assigns value to variable.

example:

int a=6;

It means, we are assignming value 6 to variable a.

5)Unary operator:- this operator works on one operand only.It has two types.

I) increment operator:- It increases the value of given variable by one.For example: ++y or y++

It can be classified into pre-increment and post increment.

pre-increment:- It is written as ++x.It means first increase the value and then use that.

post-increment: It is written as x++.It means, first use that and then increase its value by one.

II)decrement operator:- It decreases the value of given variable by one.For example: --y or y--

It can be classified into pre-decrement and post decrement.

pre-decrement:- It is written as --x.It means first decrease the value and then use that.

post-decrement: It is written as x--.It means, first use that and then decrease its value by one.

Besides these all, we have some other operators .like bitwise,

## No comments:

## Post a Comment