what is a operator in c ?


what is a operator in c ?

     Operator :- Operator Are Nothing But The Special Symbols That Perform Of Operation On Variable.

Types Of Operators

  1. Arithmetic Operators.
  2. Relocation Operators.
  3. Logical Operators.
  4. Assignment Operators.
  5. Increment And Decrement Operators.
  6. Conditional Operators.
  7. Bitwise Operators.

1} Arithmetic Operators :-  Arithmetic Operators Are Used For To Perform Mathematical Operations On Variables.
                                                  int a =  5 , b = 12 , c ;
  1. +   Addition C = a + b = 5 + 12 = 17
  2. -   Subtraction         C = a - b = 5 - 12 = 7
  3. *  Multiplication C = a * b = 5 * 12 = 60
  4.  /  Division C = a /  b = 5 / 12 =  0
  5.  %  Modulus C = a % b = 5 % 12 = 5

2} Relocation Operators :-  Relocation Operator Are Used For To Perform Relocation ( comparison ) Operations On Variables.
  1.  <  Less Than.
  2.  >  Greater Than.
  3.  < =  Less Than Or Equal.
  4.  > =  Greater Than Or Equal.
  5.  = =   Equal TO.
  6.  ! =    NOT Equal.
3} Logical Operator :- Logical Operators Perform Operations ( Compress More Than Two Relational Operator ) On Variable.
  1. &&  And 
  2. ||    Or 
  3. !      Not
1]  &&  And :-
    1  = TRUE    ,    0 = FALSE
  1. Anly One Condition Is False = False.   /*    0   &&  1    =   0  */
  2. All Condition Are True = True.   /*    1   &&   1    =   1  */
A-Truth-Table-Of-AND
A Truth Table Of AND

int  a  = 15  ,  b  =  10  , c  =  5 ;

1}  a   <  b       &&   a  <  c

     15  <   10  &&  15  <  5

            0        &&   0   =   0

 

2}  a   <  b       &&   a  >  c

     15  <   10  &&  15  >  5

           0        &&  1   =   0

 

3} a   >  b       &&   a  <  c

    15  >   10   &&  15 <  5

           1        &&  0  =   0

 

4} a   >  b       &&   a  >  c

    15  >   10   &&  15 >  5

           1        &&   1  =  1


2] ||   Or  :-

1  = TRUE    ,    0 = FALSE
  1. Anly One Condition Is True = True.   /*    0   &&  1    =   1  */
  2. All Condition Are False .   /*    1   &&  1    =   1  */
A-Truth-Table-Of-OR
A Truth Table Of OR

int  a  = 15  ,  b  =  10  , c  =  5 ;

1}  a   <  b      ||   a  <  c

     15  <   10  ||  15  <  5

            0        ||   0   =  0

 

2}  a   <  b      ||   a  >  c

     15  <   10  ||  15  >  5

           0         ||   =  1

 

3} a   >  b       ||   a  <  c

    15  >   10   ||  15 <  5

           1         ||    0 =  1

 

4} a   >  b       ||   a  >  c

    15  >   10   ||  15 >  5

           1        ||   1   =  1

 

3] ! NOT  :-

True =  False  

False  = True 

A-Truth-Table-Of-NOT
A Truth Table Of NOT

1} !    (  a     <       b   ||   a   <  c )

     !    (  15   <    10   ||  15  <    5 )

     !             0          ||     0  =     1

 

2} !    (  a     >       b   ||   a   <  c )

     !    (  15   <    10   ||  15  <    5 )

     !             1             ||    0   =     0

4} Assignment Operators :- Assignment Operators Are Used To Declination Right Side Experience Value To Left Side Variable.

Ex : 

=

a = 5 ;

b =  a  * 5 + 10 * 3 ;

b =   5  *  5  +  10  * 3  ;

b = 25  +  30 ;

b = 55  ;


  1. + =   Addition & Assignment        a  + = a = a + 7 = 10 + 7 = 17
  2. -  = Subtraction & Assignment      a  -  = a = a – 7 = 10  - 7 = 3 
  3. * = Multiplication & Assignment      a  *  = a = a  * 7 = 10 * 7 = 70
  4. /  = Division & Assignment           a  /  = a = a  / 7 = 10 / 7 = 1
  5. %  =Modulus & Assignment        a  % = a = a  %  7 = 10 % 7 = 3
Ex : 

int  a  = 10 , b = 3 , c = 5 ;

a  +  =   b  *  c  +  5  * 3

 a  +  =  3  *  5  +  5  * 3

a  +  = 15  + 15

a  +  = 30


a  =  a  +  30  

a =  10  +  30 

a  =  40 

5} 

Comments

Popular posts from this blog

Difference between cpp and java.

Addition Of Two Numbers In Java

What is the java programming language ?