Operators in C:-In a language like c an operator is a symbolic code that imposes an operation over either single or a group of operands
c supports the following three type of operators

1-:unary operator
2-:binary operator
3-:ternary operator
unary operator-:operators that require only one operand are called unary operator
for example-:
++i; //this statement inccreases the value of i by 1
here ++-:is an operator whereas "i" is an operand
binary operator-:these operators requires atleast two operands .however there is no maximum limit of operands .most of the c opearators are of binary types.
for example -:mathematical and relational operators
x=a+b
here ,a and b are operands and = and +symbols are operands
Ternary operator-:The only major operator of ternary type is the conditional operator requires atleast 3 operands
example-:____?_____:______
here ? and : are operators
list of operators in c


1-:mathematical operators
2-:relational operators
3-:logical operators
4-:increament and decreament operator
5-:conditional operator
6-:assignment operator
7-:size of operator
8-:Miscellaneous operator
1-Mathematical -:We have atotal of 5 mathematical operators that are given in c these are"+,-,*,/,%"
Priority of mathematical operators -:
First priority-:  ()
Second priority-:  /,%,*
Third priority-:  +,-
c puts only 3 levels of priority when an expression comes with two or more operators of different priorities the operator of high priority will be entertained first.
In case of two or more operators having same priority ,the first encountered will be entertained first
for example -:
2+3*6-7+9/3
2+18-7+9/3
2+18-7+3
20-7+3
13+3
16
2-Relational operator-:Operators that show relationships between two operands are called relational operators these are -:<,>,<=,>=,==,!=.
for example-:
int x,y,z;
x=5;
y=6;
z=x>=y;

Note-:the above expression will return a boolean value (0 for false and 1 for true).
Logical operators -:Logical operators introduce binary logic to the c language. It works on boolean values as well. The major use of logical operations is when we have to check two or more conditions at a time curently. These are of three types-:
Logical AND(&&)
Logical OR(||)
Logical NOT(!)
Logica AND -: Logical AND is written as (&&) it checks two condition simultaneously and performs the following logical operations


condition 1 condition 2 result
false false false
true false false
false true false
true true true

here, false represnts 0 whereas true represnts 1
for example-:int x,y,z,a;

x=5;

y=6;a=9;
z=(a>y)&&(y>x)
__true__ __true__
the final result will also be true ie 1
Logical or-:This logical the result is true when any of the conditions being tested together is true LOGICAL OR performs the following operations -:
condition 1 condition 2 result
false false FALSE
true false TRUE
false true TRUE
true true TRUE
here, false represnts 0 whereas true represnts 1
Increament and Decreament operators-:
In c increament and dcreament operators are used to increase or decrease the value of a variable the increament operator is (++) and decreament is (--)
the increament and decreament operator are further classified in two types-:
increament operator-:
-:pre increament(++var)
-:post increament(var++)
decreament operator-:
-:pre decreament(--var)
-:post decreament(var--)
example-:


#include< stdio.h>
#include< conio.h>
void main()
{
int a,b,c,d,x;
x=13;
a=x++;
b=++x;
c=x--;
d=--x;
printf("%d%d%d%d",a,b,c,d);
getch();
}


Conditional operator-:Conditional operator requires three operands the first operand is always a condition .the second operand activates whwn condition is true and third operand activates when condition is false.
for example-:int a=5,x;
x=(a>2)?(a-1):(a+1);


Asiignment operator-:It is a binary operator hence it requires two operands .th right operand to this operator is always transferred to the left operand.
for example-:

int x;
x=5;

Sizeof operator-:Size of operator reflects the size in bytes of either a variable or a data type or a constant.


for example-:

int x,y;
y=sizeof(x) or y=sizeof(int)


Miscllaneous operator:-
C supports some other operators as well and every operator has its own usage .howeverthese operators are not regularly used
address operator-:this operator reflects the adress of a variable ie stored somewhere in the memory
example-:

int x;
x=6;
printf("%d",x);
printf("%u",&x);


Comma operator-: Comma operator can be used to distinguish two or more assignment statement .It can also be used while displaying different variables .this operator is used in variable declaration as well.


program that adds every digit of a four digit number-:


#include< stdio.h>
#include< conio.h>
void main()
{
int num=1436,a,b,c,d;
a=num%10;
num=num/10;
b=num%10;
num=num/10;
c=num%10;
num=num/10;
d=num%10;
printf("%d",a+b+c+d);
getch();
}


explanation of the above code-:


1436/10=143
1436/100=14
1436/1000=1
whereas-:
1436%10=6
1436%100=36
1436%1000=436
1436%10000=1436



program to reverse a number of four digit-:

#include< stdio.h>
#include< conio.h>
void main()
{
int num=1436,a,b,c,d;
a=num%10;
num=num/10;
b=num%10;
num=num/10;
c=num%10;
num=num/10;
d=num%10;
printf("%d%d%d%d",a,b,c,d);
getch();
}



program to add 1 to all the digits of a four digit number "3768" and display the new number formed-:


#include< stdio.h>
#include< conio.h>
void main()
{
int num=1436,a,b,c,d;
a=num%10;
num=num/10;
a=a+1;
b=num%10;
num=num/10;
b=b+1;
c=num%10;
num=num/10;
c=c+1;
d=num%10;
d=d+1;
printf("%d%d%d%d",d,c,b,a);
getch();
}


program to add 1 to all the digits of a four digit number and if 9 occurs in the number convert it to zero-:


#include< stdio.h>
#include< conio.h>
void main()
{
int num=1436,a,b,c,d;
a=num%10;
num=num/10;
a=a+1;
a=a%10;
b=num%10;
num=num/10;
b=b+1;
b=b%10;
c=num%10;
num=num/10;
c=c+1;
c=c%10;
d=num%10;
d=d+1;
d=d%10;
printf("%d%d%d%d",d,c,b,a);
getch();
}