17688_lecture 4.pdf - OPERATORS BY RICHA JAIN OPERATORS \u2022 An operator is a symbol that tells the computer to perform certain mathematical or logical

17688_lecture 4.pdf - OPERATORS BY RICHA JAIN OPERATORS...

This preview shows page 1 - 6 out of 14 pages.

OPERATORS BY: RICHA JAIN
Image of page 1
OPERATORS An operator is a symbol that tells the computer to perform certain mathematical or logical manipulations. Types of operators are: 1. Arithmetic operator 2. Relational operator 3. Logical operator 4. Assignment operator 5. Unary operator 6. Conditional operator 7. Bitwise operator 8. Special operator
Image of page 2
Operator Description Example + Adds two operands A + B will give 30 - Subtracts second operand from the first A - B will give -10 * Multiply both operands A * B will give 200 / Divide numerator by de-numerator B / A will give 2 % Modulus Operator and remainder of after an integer division B % A will give 0 EXAMPLE: Arithmetic operators (A=10,B=20)
Image of page 3
Relational Operators It Compare two operands depending upon the their relation. Syntax Op1 Operator Op2 Example : a > b
Image of page 4
EXAMPLE: Relational operators(A=10,B=20) Operator Description Example == Checks if the value of two operands is equal or not, if yes then condition becomes true. (A == B) is not true. != Checks if the value of two operands is equal or not, if values are not equal then condition becomes true. (A != B) is true. > Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true. (A > B) is not true. < Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true.
Image of page 5
Image of page 6

You've reached the end of your free preview.

Want to read all 14 pages?

  • Spring '19
  • C Programming, relational operator, Unary operation, Programming constructs, Bitwise operation

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture