Lec c1 - Todays Agenda OperatorsandExpressions...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
14 th March 2009 Today’s Agenda  Operators and Expressions  Arithmetic Operators  Relational Operators  Logical Operators  Assignment Operators  Increment and Decrement Operators  Conditional Operators  Special Operators
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
14 th March 2009 Arithmetic Operators Operator Meaning + Addition  - Subtraction  * Multiplication / Division % Modulo Division
Background image of page 2
14 th March 2009 Arithmetic Expression   Let int x = 15; int y = 6; Example: x-y = 9 x+y = 21 x*y = 90 x/y = 2 (decimal part truncated) x%y = 3 (remainder of the division) Q. If x and y are declared as float then? Q. If x is integer and y is float then? 
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
14 th March 2009 More Examples: Write a equivalent  C expression for given algebraic   expressions. 1. (a+b)(c+d) 2. ax 2 +bx+c 1. π r 2 +2 π rh 1. s = ut + 1/2at 2 2. T = (m1m2/m1+m2)
Background image of page 4
14 th March 2009 Relational Operators   Operator Meaning < Is less than <= Is less than or equal to > Is greater than >= Is greater than or equal to == Is equal to != Is not equal to
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 15

Lec c1 - Todays Agenda OperatorsandExpressions...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online