# Lec20 - Computer Programming I TA C162 Today's Agenda...

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

1 Computer Programming I TA C162 . 24/02/07 Today’s Agenda  Operators and Expressions  Arithmetic Operators  Relational Operators  Logical Operators  Assignment Operators  Increment and Decrement Operators  Conditional Operators  Bitwise Operators  Special Operators

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

View Full Document
2 Computer Programming I TA C162 . 24/02/07 Arithmetic Operators Operator Meaning + Addition or unary plus - Subtraction or unary minus * Multiplication / Division % Modulo Division
3 Computer Programming I TA C162 . 24/02/07 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?

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

View Full Document
4 Computer Programming I TA C162 . 24/02/07 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)
5 Computer Programming I TA C162 . 24/02/07

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 17

Lec20 - Computer Programming I TA C162 Today's Agenda...

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

View Full Document
Ask a homework question - tutors are online