SlideShare uma empresa Scribd logo
1 de 37
Operators and Expressions

       www.eshikshak.co.in
Introduction
• An operator indicates an operation to be
  performed on data that yields a new value.
• An operand is a data items on which operators
  perform operations.
• C provides rich set of “Operators”
  – Arithmetic
  – Relational
  – Logical
  – Bitwise

                    www.eshikshak.co.in
Introduction




   www.eshikshak.co.in
Properties of Operators
• Precedence
  – Precedence means priority.
  – When an expressions contains many operators,
    the operations are carried out according to the
    priority of the operators.
  – The higher priority operations are solved first.
  – Example
     • 10 * 5 + 4 / 2
     • 10 + 5 – 8 * 2 / 2

                            www.eshikshak.co.in
Properties of Operators
•   Associativity
     – Associativity means the direction of execution.
     – When an expression has operators with same precedence, the associativity
        property decides which operation to be carried out first.
     a) Left to Right : The expression evaluation starts from the left to right direction
               Example : 12 * 4 / 8 % 2
                             48 / 8 % 2
                                  6%2
                                  0
     b) Right to Left : The expression evaluation starts from right to left direction
              Example : X = 8 + 5 % 2
                         X=8+1
                 X=9




                                      www.eshikshak.co.in
Priority of Operators and their clubbing

• Each and every operator in C having its
  priority and precedence fixed on the basis of
  these property expression is solved.
• Operators from the same group may have
  different precedence and associativity.
• If arithmetic expression contains more
  operators, the execution will be performed
  according to their priorities.

                    www.eshikshak.co.in
Priority of Operators and their clubbing

• When two operators of the same priority are
  found in the expression, the precedence is
  given from the left most operators.
  x=5*4+8/2                                (8 / ( 2 * ( 2 * 2 ) ) )
                  2                                                    1
      1

                                                                   2
            3


                                                              3


                      www.eshikshak.co.in
Comma and Conditional Operator
• It is used to separate two                 void main()
  or more expressions.                       {
• It has lowest precedence
                                                clrscr();
  among all the operators
• It is not essential to                       printf(“%d %d”, 2+3, 3-2);
  enclose the expressions                    }
  with comma operators
  within the parenthesis.
                                            OUTPUT :
• Following statements are
  valid                                     5 1
    a = 2, b = 4, c = a + b;
    ( a=2, b = 4, c = a + b );

                             www.eshikshak.co.in
Conditional Operator (?:)
• This operator contains condition followed by
  two statements and values.
• It is also called as ternary operator.
• Syntax :
  Condition ? (expression1) : (expression2);
• If the condition is true, than expression1 is
  executed, otherwise expression2 is executed


                      www.eshikshak.co.in
Conditional Operator (?:)
• Example :
     void main()
     {
          clrscr();
          printf(“Maximum : %d”, 5>3 ? 5 : 3)
     }
OUTPUT :
  Maximum : 5

                   www.eshikshak.co.in
Conditional Operator (?:)
• Example :
     void main()
     {
          clrscr();
          printf(“Maximum : %d”, 5>3 ? 5 : 3)
     }
OUTPUT :
  Maximum : 5

                   www.eshikshak.co.in
Conditional Operator (?:)
• Example :
     void main()
     {
           clrscr();
           5 > 3 ? printf(“True”) : printf(“False”);
           printf(“%d is ”, 5>3 ? : 3)
     }
OUTPUT :
  Maximum : 5
                      www.eshikshak.co.in
Arithmetic Operator
• Two types of arithmetic operators
  – Binary Operator
  – Unary Operator
                      Operators


     Unary              Binary              Ternary




                      www.eshikshak.co.in
Arithmetic Operator
• Binary Operator
   – An operator which requires two operator is know
     as binary operator
   – List of Binary Operators
Arithmetic Operator   Operator Explanation              Examples
        +                   Addition                    2+2=4
         -                Subtraction                   5–3=2
        *                Multiplication                 2 * 5 = 10
         /                  Division                    10 / 2 = 5
        %               Modular Division         11 % 3 = 2 (Remainder 2)


                           www.eshikshak.co.in
Arithmetic Operator
• Unary Operator
  – The operator which requires only one operand is
    called unary operator
  – List of unary operator are
    Operator      Description or Action
    -             Minus
    ++            Increment
    --            Decrement
    &             Address Operator
    Sizeof        Gives the size of the operator

                           www.eshikshak.co.in
Unary Operator - Minus
• Unary minus is used for indicating or changing
  the algebraic sign of a value
• Example
    int x = -50;
    int y = -x;
• There is no unary plus (+) in C. Even though a
  value assigned with plus sign is valid.


                    www.eshikshak.co.in
Increment (++) and Decrement (--)
              Operator
• The ++ operator adds value one to its
  operand.
• X = X + 1 can be written as X++;
• There are two types ++ increment operator
  base on the position are used with the
  operand.



                   www.eshikshak.co.in
Pre-increment (i.e. ++x)
int x =5, y;
y = ++x;
printf(“x = %dn y = %d”, ++x, y);

OUTPUT :                                   x = x + 1;

x=7                 y = ++x;
y=6                                        y = x;


                     www.eshikshak.co.in
Post-increment (i.e. ++x)
int x =5, y;
y = x++;
printf(“x = %dn y = %d”, x++, y);

OUTPUT :                                   y = x;

x=7                 y = x++;
y=6                                        x = x + 1;


                     www.eshikshak.co.in
Pre-decrement (i.e. --x)
int x =5, y;
y = --x;
printf(“x = %dn y = %d”, --x, y);

OUTPUT :                                   x = x - 1;

x=3                 y = --x;
y=4                                        y = x;


                     www.eshikshak.co.in
Post-decrement (i.e. ++x)
int x =5, y;
y = x--;
printf(“x = %dn y = %d”, x--, y);

OUTPUT :                                   y = x;

x=7                 y = x--;
y=6                                        x = x - 1;


                     www.eshikshak.co.in
sizeof operator
• The sizeof operator           void main()
  gives the bytes               {
  occupied by a variable.          int x = 12;
• i.e. the size in terms of       float y = 2;
  bytes required in                printf(“size of x : %d”, sizeof(x));
                                  printf(“nsize of y :%d”, sizeof(y));
  memory to store the
  value.                        }

• The number of bytes           OUTPUT :
  occupied varies from          sizeof x : 2
  variable to variable          sizeof y : 4
  depending upon its
  data type.
                         www.eshikshak.co.in
‘&’ Operator
• The ‘&’ returns the address of the variable in a
  memory.

  Address
                                        int x = 15
                2040
                                        printf(“%d”,x);
    Value
                 15
   Variable      X
                                        printf(“n%u”,&x);



                       www.eshikshak.co.in
Relational Operator
• These operators are used to distinguish
  two values depending on their relations.
• These operators provide the relationship
  between two expressions.
• If the relation is true it returns a value 1
  otherwise 0 for false.


                   www.eshikshak.co.in
Relational Operator
Operator    Description or Action              Example Return Value
   >            Greater than                    5>4          1
   <              Less than                    10 < 9        0
  <=        Less than or equal to              10 <= 10      1

  >=       Greater than or equal to            11 >= 5       1
  ==              Equal to                      2 == 3       0
   !=           Not Equal to                    3 != 3       0


                         www.eshikshak.co.in
Assignment Operator
• Assigning a value to a variable is very sample.
  int x = 5

                      Assignment Operator
          =             *=                          /=    %=
         +=              -=                         <<=   >>=
        >>>=            &=                          ^=    !=

int x = 10;
printf(“x = %dn”,x += 5); // x = x + 5; O/P x = 15

                              www.eshikshak.co.in
Logical Operators
• The logical operator between the two
  expressions is tested with logical operators.
• Using these operators, two expressions can be
  joined.
• After checking the conditions, it provides
  logical true(1) or false(0) status.
• The operands could be constants, variables
  and expressions.

                   www.eshikshak.co.in
Logical Operators
Operator   Description or Action            Example       Return Value
   &&          Logical AND             5 > 3 && 5 < 10         1
   ||           Logical OR               8 > 5 || 8 < 2        1
    !          Logical NOT                    8 != 8           0


i. The logical AND (&&) operator provides true result
     when both expressions are true otherwise 0.
ii. The logical OR (||) operator true result when one of
     the expressions is true otherwise 0.
iii. The logical NOT (!) provides 0 if the condition is true
     otherwise 1.

                             www.eshikshak.co.in
Bitwise Operator
• C supports a set of bitwise operators for bit
  manipulation

       Operators   Meaning
       >>          Right Shift
       <<          Left Shift
       ^           Bitwise XOR (exclusive OR)
       ~           One’s Complement
       &           Bitwise AND
       |           Bitwise |



                          www.eshikshak.co.in
void main() two bits means the inputted number is to be divided by 2 s where
  Shifting of
{ s is the number of shifts i.e. in short y = n/2s
    int x, y;
  Where n = number and s = the number of position to be shift.
     clrscr();
  For example as Thethe program keyword (x) ;
     print(“Read per Integer from
     scanf(“%d”, &x); // input value for x = 8
    Y = 8 / 22 = 2
            2




      x>>2;
      y=x;
     printf(“The Right shifted data is = %d”, y);




                                  www.eshikshak.co.in
}
void main() three bits left means the number is multiplied by 8; in short
  Shifting of
{ y = n * 2s
  where n = number
   int x, y;
          s = the number of position to be shifted
    clrscr();
  Asprint(“Read The Integer from keyword (x) ;
     per the program
    scanf(“%d”, &x); // input value for x = 2
    Y=2*2  3




     x<<=3;
     y=x;
    printf(“The Right shifted data is = %d”, y);




                                  www.eshikshak.co.in
}
void main()
{
    int a, b, c;
    clrscr();
     printf(“Read the integers from keyboard ( a & b ) :”);
     scanf(“%d %d”, &a, &b);
     c = a & b;
     printf(“The answer after ANDing is (C) = %d”, c);
}

OUTPUT :
Read the Integers from keyboard (a & b) : 8 4
The Answer after ANDing is (C) = 0

                           www.eshikshak.co.in
Table of exclusive AND
X         Y                         Outputs

0         0                         0

0         1                         0

1         0                         0

1         1                         1




              www.eshikshak.co.in
Binary equivalent of 8




Binary equivalent of 4




After execution
C=0
Binary equivalent of 0




                         www.eshikshak.co.in
void main()
{
    int a, b, c;
    clrscr();
     printf(“Read the integers from keyboard ( a & b ) :”);
     scanf(“%d %d”, &a, &b);
     c = a | b;
     printf(“The answer after ORing is (C) = %d”, c);
}

OUTPUT :
Read the Integers from keyboard (a & b) : 8 4
The Answer after ORing is (C) = 12

                           www.eshikshak.co.in
Table of exclusive OR
X         Y                         Outputs

0         0                         0

0         1                         1

1         0                         1

1         1                         0




              www.eshikshak.co.in
Binary equivalent of 8




Binary equivalent of 4




After execution
C = 12
Binary equivalent of 0




                         www.eshikshak.co.in

Mais conteúdo relacionado

Destaque

Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’eShikshak
 
Operator Precedence and Associativity
Operator Precedence and AssociativityOperator Precedence and Associativity
Operator Precedence and AssociativityNicole Ynne Estabillo
 
Html phrase tags
Html phrase tagsHtml phrase tags
Html phrase tagseShikshak
 
Lecture21 categoriesof userdefinedfunctions.ppt
Lecture21 categoriesof userdefinedfunctions.pptLecture21 categoriesof userdefinedfunctions.ppt
Lecture21 categoriesof userdefinedfunctions.ppteShikshak
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’eShikshak
 
Lecture15 comparisonoftheloopcontrolstructures.ppt
Lecture15 comparisonoftheloopcontrolstructures.pptLecture15 comparisonoftheloopcontrolstructures.ppt
Lecture15 comparisonoftheloopcontrolstructures.ppteShikshak
 
Mesics lecture 3 c – constants and variables
Mesics lecture 3   c – constants and variablesMesics lecture 3   c – constants and variables
Mesics lecture 3 c – constants and variableseShikshak
 
Lecture 7 relational_and_logical_operators
Lecture 7 relational_and_logical_operatorsLecture 7 relational_and_logical_operators
Lecture 7 relational_and_logical_operatorseShikshak
 
Lecture7relationalandlogicaloperators 110823181038-phpapp02
Lecture7relationalandlogicaloperators 110823181038-phpapp02Lecture7relationalandlogicaloperators 110823181038-phpapp02
Lecture7relationalandlogicaloperators 110823181038-phpapp02eShikshak
 
Automotive Circuit Boards
Automotive Circuit BoardsAutomotive Circuit Boards
Automotive Circuit BoardsArt Wood
 
C presentation book
C presentation bookC presentation book
C presentation bookkrunal1210
 
Programming embedded system_ii_keil_8051(1)
Programming embedded system_ii_keil_8051(1)Programming embedded system_ii_keil_8051(1)
Programming embedded system_ii_keil_8051(1)Fendie Mimpi
 
RoHS Compliant Lead Free PCB Fabrication
RoHS Compliant Lead Free PCB FabricationRoHS Compliant Lead Free PCB Fabrication
RoHS Compliant Lead Free PCB FabricationArt Wood
 
Mesics lecture files in 'c'
Mesics lecture   files in 'c'Mesics lecture   files in 'c'
Mesics lecture files in 'c'eShikshak
 
Unit 1.3 types of cloud
Unit 1.3 types of cloudUnit 1.3 types of cloud
Unit 1.3 types of cloudeShikshak
 
Mesics lecture 8 arrays in 'c'
Mesics lecture 8   arrays in 'c'Mesics lecture 8   arrays in 'c'
Mesics lecture 8 arrays in 'c'eShikshak
 
Mesics lecture 7 iteration and repetitive executions
Mesics lecture 7   iteration and repetitive executionsMesics lecture 7   iteration and repetitive executions
Mesics lecture 7 iteration and repetitive executionseShikshak
 
Unit 1.1 introduction to cloud computing
Unit 1.1   introduction to cloud computingUnit 1.1   introduction to cloud computing
Unit 1.1 introduction to cloud computingeShikshak
 

Destaque (20)

Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’
 
Operator Precedence and Associativity
Operator Precedence and AssociativityOperator Precedence and Associativity
Operator Precedence and Associativity
 
Html phrase tags
Html phrase tagsHtml phrase tags
Html phrase tags
 
Lecture21 categoriesof userdefinedfunctions.ppt
Lecture21 categoriesof userdefinedfunctions.pptLecture21 categoriesof userdefinedfunctions.ppt
Lecture21 categoriesof userdefinedfunctions.ppt
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’
 
Lecture15 comparisonoftheloopcontrolstructures.ppt
Lecture15 comparisonoftheloopcontrolstructures.pptLecture15 comparisonoftheloopcontrolstructures.ppt
Lecture15 comparisonoftheloopcontrolstructures.ppt
 
Mesics lecture 3 c – constants and variables
Mesics lecture 3   c – constants and variablesMesics lecture 3   c – constants and variables
Mesics lecture 3 c – constants and variables
 
Lecture 7 relational_and_logical_operators
Lecture 7 relational_and_logical_operatorsLecture 7 relational_and_logical_operators
Lecture 7 relational_and_logical_operators
 
Lecture7relationalandlogicaloperators 110823181038-phpapp02
Lecture7relationalandlogicaloperators 110823181038-phpapp02Lecture7relationalandlogicaloperators 110823181038-phpapp02
Lecture7relationalandlogicaloperators 110823181038-phpapp02
 
Automotive Circuit Boards
Automotive Circuit BoardsAutomotive Circuit Boards
Automotive Circuit Boards
 
C presentation book
C presentation bookC presentation book
C presentation book
 
Programming embedded system_ii_keil_8051(1)
Programming embedded system_ii_keil_8051(1)Programming embedded system_ii_keil_8051(1)
Programming embedded system_ii_keil_8051(1)
 
RoHS Compliant Lead Free PCB Fabrication
RoHS Compliant Lead Free PCB FabricationRoHS Compliant Lead Free PCB Fabrication
RoHS Compliant Lead Free PCB Fabrication
 
Mesics lecture files in 'c'
Mesics lecture   files in 'c'Mesics lecture   files in 'c'
Mesics lecture files in 'c'
 
Algorithm
AlgorithmAlgorithm
Algorithm
 
Unit 1.3 types of cloud
Unit 1.3 types of cloudUnit 1.3 types of cloud
Unit 1.3 types of cloud
 
Mesics lecture 8 arrays in 'c'
Mesics lecture 8   arrays in 'c'Mesics lecture 8   arrays in 'c'
Mesics lecture 8 arrays in 'c'
 
Mesics lecture 7 iteration and repetitive executions
Mesics lecture 7   iteration and repetitive executionsMesics lecture 7   iteration and repetitive executions
Mesics lecture 7 iteration and repetitive executions
 
Unit 1.1 introduction to cloud computing
Unit 1.1   introduction to cloud computingUnit 1.1   introduction to cloud computing
Unit 1.1 introduction to cloud computing
 
SMT machine Training Manual for FUJI CP6 Series Level 3
SMT machine Training Manual for FUJI  CP6 Series Level 3SMT machine Training Manual for FUJI  CP6 Series Level 3
SMT machine Training Manual for FUJI CP6 Series Level 3
 

Semelhante a Mesics lecture 4 c operators and experssions

Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++Neeru Mittal
 
Operators inc c language
Operators inc c languageOperators inc c language
Operators inc c languageTanmay Modi
 
Operators and expressions in c language
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c languagetanmaymodi4
 
Java script questions
Java script questionsJava script questions
Java script questionsSrikanth
 
Operators in java script
Operators   in  java scriptOperators   in  java script
Operators in java scriptAbhinav Somani
 
Operators in c language
Operators in c languageOperators in c language
Operators in c languageAmit Singh
 
Chapter 3.3
Chapter 3.3Chapter 3.3
Chapter 3.3sotlsoc
 
Class_IX_Operators.pptx
Class_IX_Operators.pptxClass_IX_Operators.pptx
Class_IX_Operators.pptxrinkugupta37
 
Functional Operations - Susan Potter
Functional Operations - Susan PotterFunctional Operations - Susan Potter
Functional Operations - Susan Potterdistributed matters
 
c++ Data Types and Selection
c++ Data Types and Selectionc++ Data Types and Selection
c++ Data Types and SelectionAhmed Nobi
 
Basic_C++ Notes with problema from Preethi arora and suneetha arora.pdf
Basic_C++ Notes with problema from Preethi arora and suneetha arora.pdfBasic_C++ Notes with problema from Preethi arora and suneetha arora.pdf
Basic_C++ Notes with problema from Preethi arora and suneetha arora.pdfComputer Programmer
 
Pi j1.3 operators
Pi j1.3 operatorsPi j1.3 operators
Pi j1.3 operatorsmcollison
 
FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3rohassanie
 

Semelhante a Mesics lecture 4 c operators and experssions (20)

Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++
 
Operators inc c language
Operators inc c languageOperators inc c language
Operators inc c language
 
Operators and expressions in c language
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c language
 
Java script questions
Java script questionsJava script questions
Java script questions
 
Operators in java script
Operators   in  java scriptOperators   in  java script
Operators in java script
 
Operators
OperatorsOperators
Operators
 
Operators in C++
Operators in C++Operators in C++
Operators in C++
 
Operators in c language
Operators in c languageOperators in c language
Operators in c language
 
Chapter 3.3
Chapter 3.3Chapter 3.3
Chapter 3.3
 
C++ Tokens
C++ TokensC++ Tokens
C++ Tokens
 
Class_IX_Operators.pptx
Class_IX_Operators.pptxClass_IX_Operators.pptx
Class_IX_Operators.pptx
 
Functional Operations - Susan Potter
Functional Operations - Susan PotterFunctional Operations - Susan Potter
Functional Operations - Susan Potter
 
operators.ppt
operators.pptoperators.ppt
operators.ppt
 
Unit2wt
Unit2wtUnit2wt
Unit2wt
 
Unit2wt
Unit2wtUnit2wt
Unit2wt
 
c++ Data Types and Selection
c++ Data Types and Selectionc++ Data Types and Selection
c++ Data Types and Selection
 
Basic_C++ Notes with problema from Preethi arora and suneetha arora.pdf
Basic_C++ Notes with problema from Preethi arora and suneetha arora.pdfBasic_C++ Notes with problema from Preethi arora and suneetha arora.pdf
Basic_C++ Notes with problema from Preethi arora and suneetha arora.pdf
 
Pi j1.3 operators
Pi j1.3 operatorsPi j1.3 operators
Pi j1.3 operators
 
FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3
 
What is c
What is cWhat is c
What is c
 

Mais de eShikshak

Modelling and evaluation
Modelling and evaluationModelling and evaluation
Modelling and evaluationeShikshak
 
Operators in python
Operators in pythonOperators in python
Operators in pythoneShikshak
 
Datatypes in python
Datatypes in pythonDatatypes in python
Datatypes in pythoneShikshak
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to pythoneShikshak
 
Introduction to e commerce
Introduction to e commerceIntroduction to e commerce
Introduction to e commerceeShikshak
 
Chapeter 2 introduction to cloud computing
Chapeter 2   introduction to cloud computingChapeter 2   introduction to cloud computing
Chapeter 2 introduction to cloud computingeShikshak
 
Unit 1.4 working of cloud computing
Unit 1.4 working of cloud computingUnit 1.4 working of cloud computing
Unit 1.4 working of cloud computingeShikshak
 
Unit 1.2 move to cloud computing
Unit 1.2   move to cloud computingUnit 1.2   move to cloud computing
Unit 1.2 move to cloud computingeShikshak
 
Mesics lecture 6 control statement = if -else if__else
Mesics lecture 6   control statement = if -else if__elseMesics lecture 6   control statement = if -else if__else
Mesics lecture 6 control statement = if -else if__elseeShikshak
 
Lecture20 user definedfunctions.ppt
Lecture20 user definedfunctions.pptLecture20 user definedfunctions.ppt
Lecture20 user definedfunctions.ppteShikshak
 
Lecture18 structurein c.ppt
Lecture18 structurein c.pptLecture18 structurein c.ppt
Lecture18 structurein c.ppteShikshak
 
Lecture17 arrays.ppt
Lecture17 arrays.pptLecture17 arrays.ppt
Lecture17 arrays.ppteShikshak
 
Lecture13 control statementswitch.ppt
Lecture13 control statementswitch.pptLecture13 control statementswitch.ppt
Lecture13 control statementswitch.ppteShikshak
 
Lecturer23 pointersin c.ppt
Lecturer23 pointersin c.pptLecturer23 pointersin c.ppt
Lecturer23 pointersin c.ppteShikshak
 
Lecture19 unionsin c.ppt
Lecture19 unionsin c.pptLecture19 unionsin c.ppt
Lecture19 unionsin c.ppteShikshak
 
Program development cyle
Program development cyleProgram development cyle
Program development cyleeShikshak
 
Language processors
Language processorsLanguage processors
Language processorseShikshak
 
Computer programming programming_langugages
Computer programming programming_langugagesComputer programming programming_langugages
Computer programming programming_langugageseShikshak
 

Mais de eShikshak (18)

Modelling and evaluation
Modelling and evaluationModelling and evaluation
Modelling and evaluation
 
Operators in python
Operators in pythonOperators in python
Operators in python
 
Datatypes in python
Datatypes in pythonDatatypes in python
Datatypes in python
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Introduction to e commerce
Introduction to e commerceIntroduction to e commerce
Introduction to e commerce
 
Chapeter 2 introduction to cloud computing
Chapeter 2   introduction to cloud computingChapeter 2   introduction to cloud computing
Chapeter 2 introduction to cloud computing
 
Unit 1.4 working of cloud computing
Unit 1.4 working of cloud computingUnit 1.4 working of cloud computing
Unit 1.4 working of cloud computing
 
Unit 1.2 move to cloud computing
Unit 1.2   move to cloud computingUnit 1.2   move to cloud computing
Unit 1.2 move to cloud computing
 
Mesics lecture 6 control statement = if -else if__else
Mesics lecture 6   control statement = if -else if__elseMesics lecture 6   control statement = if -else if__else
Mesics lecture 6 control statement = if -else if__else
 
Lecture20 user definedfunctions.ppt
Lecture20 user definedfunctions.pptLecture20 user definedfunctions.ppt
Lecture20 user definedfunctions.ppt
 
Lecture18 structurein c.ppt
Lecture18 structurein c.pptLecture18 structurein c.ppt
Lecture18 structurein c.ppt
 
Lecture17 arrays.ppt
Lecture17 arrays.pptLecture17 arrays.ppt
Lecture17 arrays.ppt
 
Lecture13 control statementswitch.ppt
Lecture13 control statementswitch.pptLecture13 control statementswitch.ppt
Lecture13 control statementswitch.ppt
 
Lecturer23 pointersin c.ppt
Lecturer23 pointersin c.pptLecturer23 pointersin c.ppt
Lecturer23 pointersin c.ppt
 
Lecture19 unionsin c.ppt
Lecture19 unionsin c.pptLecture19 unionsin c.ppt
Lecture19 unionsin c.ppt
 
Program development cyle
Program development cyleProgram development cyle
Program development cyle
 
Language processors
Language processorsLanguage processors
Language processors
 
Computer programming programming_langugages
Computer programming programming_langugagesComputer programming programming_langugages
Computer programming programming_langugages
 

Último

Call Girls Zirakpur👧 Book Now📱7837612180 📞👉Call Girl Service In Zirakpur No A...
Call Girls Zirakpur👧 Book Now📱7837612180 📞👉Call Girl Service In Zirakpur No A...Call Girls Zirakpur👧 Book Now📱7837612180 📞👉Call Girl Service In Zirakpur No A...
Call Girls Zirakpur👧 Book Now📱7837612180 📞👉Call Girl Service In Zirakpur No A...Sheetaleventcompany
 
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al MizharAl Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizharallensay1
 
Famous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st CenturyFamous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st Centuryrwgiffor
 
Malegaon Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort Service
Malegaon Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort ServiceMalegaon Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort Service
Malegaon Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort ServiceDamini Dixit
 
Phases of Negotiation .pptx
 Phases of Negotiation .pptx Phases of Negotiation .pptx
Phases of Negotiation .pptxnandhinijagan9867
 
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876dlhescort
 
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...amitlee9823
 
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdfDr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdfAdmir Softic
 
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai KuwaitThe Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwaitdaisycvs
 
Eluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort Service
Eluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort ServiceEluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort Service
Eluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort ServiceDamini Dixit
 
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...lizamodels9
 
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...amitlee9823
 
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangaloreamitlee9823
 
Call Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂Escort
Call Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂EscortCall Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂Escort
Call Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂Escortdlhescort
 
Cracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptxCracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptxWorkforce Group
 
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...lizamodels9
 
Lundin Gold - Q1 2024 Conference Call Presentation (Revised)
Lundin Gold - Q1 2024 Conference Call Presentation (Revised)Lundin Gold - Q1 2024 Conference Call Presentation (Revised)
Lundin Gold - Q1 2024 Conference Call Presentation (Revised)Adnet Communications
 
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...Aggregage
 
Business Model Canvas (BMC)- A new venture concept
Business Model Canvas (BMC)-  A new venture conceptBusiness Model Canvas (BMC)-  A new venture concept
Business Model Canvas (BMC)- A new venture conceptP&CO
 

Último (20)

Call Girls Zirakpur👧 Book Now📱7837612180 📞👉Call Girl Service In Zirakpur No A...
Call Girls Zirakpur👧 Book Now📱7837612180 📞👉Call Girl Service In Zirakpur No A...Call Girls Zirakpur👧 Book Now📱7837612180 📞👉Call Girl Service In Zirakpur No A...
Call Girls Zirakpur👧 Book Now📱7837612180 📞👉Call Girl Service In Zirakpur No A...
 
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al MizharAl Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
 
Famous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st CenturyFamous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st Century
 
(Anamika) VIP Call Girls Napur Call Now 8617697112 Napur Escorts 24x7
(Anamika) VIP Call Girls Napur Call Now 8617697112 Napur Escorts 24x7(Anamika) VIP Call Girls Napur Call Now 8617697112 Napur Escorts 24x7
(Anamika) VIP Call Girls Napur Call Now 8617697112 Napur Escorts 24x7
 
Malegaon Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort Service
Malegaon Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort ServiceMalegaon Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort Service
Malegaon Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort Service
 
Phases of Negotiation .pptx
 Phases of Negotiation .pptx Phases of Negotiation .pptx
Phases of Negotiation .pptx
 
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
 
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
 
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdfDr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
 
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai KuwaitThe Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
 
Eluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort Service
Eluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort ServiceEluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort Service
Eluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort Service
 
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
 
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
Call Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂Escort
Call Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂EscortCall Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂Escort
Call Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂Escort
 
Cracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptxCracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptx
 
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
 
Lundin Gold - Q1 2024 Conference Call Presentation (Revised)
Lundin Gold - Q1 2024 Conference Call Presentation (Revised)Lundin Gold - Q1 2024 Conference Call Presentation (Revised)
Lundin Gold - Q1 2024 Conference Call Presentation (Revised)
 
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
 
Business Model Canvas (BMC)- A new venture concept
Business Model Canvas (BMC)-  A new venture conceptBusiness Model Canvas (BMC)-  A new venture concept
Business Model Canvas (BMC)- A new venture concept
 

Mesics lecture 4 c operators and experssions

  • 1. Operators and Expressions www.eshikshak.co.in
  • 2. Introduction • An operator indicates an operation to be performed on data that yields a new value. • An operand is a data items on which operators perform operations. • C provides rich set of “Operators” – Arithmetic – Relational – Logical – Bitwise www.eshikshak.co.in
  • 3. Introduction www.eshikshak.co.in
  • 4. Properties of Operators • Precedence – Precedence means priority. – When an expressions contains many operators, the operations are carried out according to the priority of the operators. – The higher priority operations are solved first. – Example • 10 * 5 + 4 / 2 • 10 + 5 – 8 * 2 / 2 www.eshikshak.co.in
  • 5. Properties of Operators • Associativity – Associativity means the direction of execution. – When an expression has operators with same precedence, the associativity property decides which operation to be carried out first. a) Left to Right : The expression evaluation starts from the left to right direction Example : 12 * 4 / 8 % 2 48 / 8 % 2 6%2 0 b) Right to Left : The expression evaluation starts from right to left direction Example : X = 8 + 5 % 2 X=8+1 X=9 www.eshikshak.co.in
  • 6. Priority of Operators and their clubbing • Each and every operator in C having its priority and precedence fixed on the basis of these property expression is solved. • Operators from the same group may have different precedence and associativity. • If arithmetic expression contains more operators, the execution will be performed according to their priorities. www.eshikshak.co.in
  • 7. Priority of Operators and their clubbing • When two operators of the same priority are found in the expression, the precedence is given from the left most operators. x=5*4+8/2 (8 / ( 2 * ( 2 * 2 ) ) ) 2 1 1 2 3 3 www.eshikshak.co.in
  • 8. Comma and Conditional Operator • It is used to separate two void main() or more expressions. { • It has lowest precedence clrscr(); among all the operators • It is not essential to printf(“%d %d”, 2+3, 3-2); enclose the expressions } with comma operators within the parenthesis. OUTPUT : • Following statements are valid 5 1  a = 2, b = 4, c = a + b;  ( a=2, b = 4, c = a + b ); www.eshikshak.co.in
  • 9. Conditional Operator (?:) • This operator contains condition followed by two statements and values. • It is also called as ternary operator. • Syntax : Condition ? (expression1) : (expression2); • If the condition is true, than expression1 is executed, otherwise expression2 is executed www.eshikshak.co.in
  • 10. Conditional Operator (?:) • Example : void main() { clrscr(); printf(“Maximum : %d”, 5>3 ? 5 : 3) } OUTPUT : Maximum : 5 www.eshikshak.co.in
  • 11. Conditional Operator (?:) • Example : void main() { clrscr(); printf(“Maximum : %d”, 5>3 ? 5 : 3) } OUTPUT : Maximum : 5 www.eshikshak.co.in
  • 12. Conditional Operator (?:) • Example : void main() { clrscr(); 5 > 3 ? printf(“True”) : printf(“False”); printf(“%d is ”, 5>3 ? : 3) } OUTPUT : Maximum : 5 www.eshikshak.co.in
  • 13. Arithmetic Operator • Two types of arithmetic operators – Binary Operator – Unary Operator Operators Unary Binary Ternary www.eshikshak.co.in
  • 14. Arithmetic Operator • Binary Operator – An operator which requires two operator is know as binary operator – List of Binary Operators Arithmetic Operator Operator Explanation Examples + Addition 2+2=4 - Subtraction 5–3=2 * Multiplication 2 * 5 = 10 / Division 10 / 2 = 5 % Modular Division 11 % 3 = 2 (Remainder 2) www.eshikshak.co.in
  • 15. Arithmetic Operator • Unary Operator – The operator which requires only one operand is called unary operator – List of unary operator are Operator Description or Action - Minus ++ Increment -- Decrement & Address Operator Sizeof Gives the size of the operator www.eshikshak.co.in
  • 16. Unary Operator - Minus • Unary minus is used for indicating or changing the algebraic sign of a value • Example int x = -50; int y = -x; • There is no unary plus (+) in C. Even though a value assigned with plus sign is valid. www.eshikshak.co.in
  • 17. Increment (++) and Decrement (--) Operator • The ++ operator adds value one to its operand. • X = X + 1 can be written as X++; • There are two types ++ increment operator base on the position are used with the operand. www.eshikshak.co.in
  • 18. Pre-increment (i.e. ++x) int x =5, y; y = ++x; printf(“x = %dn y = %d”, ++x, y); OUTPUT : x = x + 1; x=7 y = ++x; y=6 y = x; www.eshikshak.co.in
  • 19. Post-increment (i.e. ++x) int x =5, y; y = x++; printf(“x = %dn y = %d”, x++, y); OUTPUT : y = x; x=7 y = x++; y=6 x = x + 1; www.eshikshak.co.in
  • 20. Pre-decrement (i.e. --x) int x =5, y; y = --x; printf(“x = %dn y = %d”, --x, y); OUTPUT : x = x - 1; x=3 y = --x; y=4 y = x; www.eshikshak.co.in
  • 21. Post-decrement (i.e. ++x) int x =5, y; y = x--; printf(“x = %dn y = %d”, x--, y); OUTPUT : y = x; x=7 y = x--; y=6 x = x - 1; www.eshikshak.co.in
  • 22. sizeof operator • The sizeof operator void main() gives the bytes { occupied by a variable. int x = 12; • i.e. the size in terms of float y = 2; bytes required in printf(“size of x : %d”, sizeof(x)); printf(“nsize of y :%d”, sizeof(y)); memory to store the value. } • The number of bytes OUTPUT : occupied varies from sizeof x : 2 variable to variable sizeof y : 4 depending upon its data type. www.eshikshak.co.in
  • 23. ‘&’ Operator • The ‘&’ returns the address of the variable in a memory. Address int x = 15 2040 printf(“%d”,x); Value 15 Variable X printf(“n%u”,&x); www.eshikshak.co.in
  • 24. Relational Operator • These operators are used to distinguish two values depending on their relations. • These operators provide the relationship between two expressions. • If the relation is true it returns a value 1 otherwise 0 for false. www.eshikshak.co.in
  • 25. Relational Operator Operator Description or Action Example Return Value > Greater than 5>4 1 < Less than 10 < 9 0 <= Less than or equal to 10 <= 10 1 >= Greater than or equal to 11 >= 5 1 == Equal to 2 == 3 0 != Not Equal to 3 != 3 0 www.eshikshak.co.in
  • 26. Assignment Operator • Assigning a value to a variable is very sample. int x = 5 Assignment Operator = *= /= %= += -= <<= >>= >>>= &= ^= != int x = 10; printf(“x = %dn”,x += 5); // x = x + 5; O/P x = 15 www.eshikshak.co.in
  • 27. Logical Operators • The logical operator between the two expressions is tested with logical operators. • Using these operators, two expressions can be joined. • After checking the conditions, it provides logical true(1) or false(0) status. • The operands could be constants, variables and expressions. www.eshikshak.co.in
  • 28. Logical Operators Operator Description or Action Example Return Value && Logical AND 5 > 3 && 5 < 10 1 || Logical OR 8 > 5 || 8 < 2 1 ! Logical NOT 8 != 8 0 i. The logical AND (&&) operator provides true result when both expressions are true otherwise 0. ii. The logical OR (||) operator true result when one of the expressions is true otherwise 0. iii. The logical NOT (!) provides 0 if the condition is true otherwise 1. www.eshikshak.co.in
  • 29. Bitwise Operator • C supports a set of bitwise operators for bit manipulation Operators Meaning >> Right Shift << Left Shift ^ Bitwise XOR (exclusive OR) ~ One’s Complement & Bitwise AND | Bitwise | www.eshikshak.co.in
  • 30. void main() two bits means the inputted number is to be divided by 2 s where Shifting of { s is the number of shifts i.e. in short y = n/2s int x, y; Where n = number and s = the number of position to be shift. clrscr(); For example as Thethe program keyword (x) ; print(“Read per Integer from scanf(“%d”, &x); // input value for x = 8 Y = 8 / 22 = 2 2 x>>2; y=x; printf(“The Right shifted data is = %d”, y); www.eshikshak.co.in }
  • 31. void main() three bits left means the number is multiplied by 8; in short Shifting of { y = n * 2s where n = number int x, y; s = the number of position to be shifted clrscr(); Asprint(“Read The Integer from keyword (x) ; per the program scanf(“%d”, &x); // input value for x = 2 Y=2*2 3 x<<=3; y=x; printf(“The Right shifted data is = %d”, y); www.eshikshak.co.in }
  • 32. void main() { int a, b, c; clrscr(); printf(“Read the integers from keyboard ( a & b ) :”); scanf(“%d %d”, &a, &b); c = a & b; printf(“The answer after ANDing is (C) = %d”, c); } OUTPUT : Read the Integers from keyboard (a & b) : 8 4 The Answer after ANDing is (C) = 0 www.eshikshak.co.in
  • 33. Table of exclusive AND X Y Outputs 0 0 0 0 1 0 1 0 0 1 1 1 www.eshikshak.co.in
  • 34. Binary equivalent of 8 Binary equivalent of 4 After execution C=0 Binary equivalent of 0 www.eshikshak.co.in
  • 35. void main() { int a, b, c; clrscr(); printf(“Read the integers from keyboard ( a & b ) :”); scanf(“%d %d”, &a, &b); c = a | b; printf(“The answer after ORing is (C) = %d”, c); } OUTPUT : Read the Integers from keyboard (a & b) : 8 4 The Answer after ORing is (C) = 12 www.eshikshak.co.in
  • 36. Table of exclusive OR X Y Outputs 0 0 0 0 1 1 1 0 1 1 1 0 www.eshikshak.co.in
  • 37. Binary equivalent of 8 Binary equivalent of 4 After execution C = 12 Binary equivalent of 0 www.eshikshak.co.in