OPERATORS BY: RICHA JAIN
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
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)
Relational Operators • It Compare two operands depending upon the their relation. • Syntax Op1 Operator Op2 • Example : a > b
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.
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