Lecture 13 Arithmatic in C

# Lecture 13 Arithmatic in C - Lecture13:ArithmeticinC...

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

FAST, National University of Computer and Emerging Sciences, Islamabad 1 Lecture 13:  Arithmetic in C Course: Programming For Engineers-1

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

View Full Document
2 Reference Ch.2 of the Text Book
3 Expressions expressions  are used to express computation. Expressions include operations and the  operands  on which the  operations are applied. Operands can be variables, literals or constants. Operations are mathematical operators like (+,/,-,*.%).

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

View Full Document
4 Arithmetic Operators Operators allowed in an expression depend upon the  data types of constants and variables in the  expression. Operand   variable or a constant on which an operator is applied is called an operand . 67 + 25   operator +, operands 67 and 25
5  Arithmetic Operators C operation Arithmetic operator Algebraic expression C expression Addition f + 7 f + 7  Subtraction p – c p - c  Multiplication bm b * m   Division x / y x / y  Modulus r mod s r % s

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

View Full Document
6 Precedence and Associativity   Operators have rules of  precedence  and  associativity   that control how expressions are  evaluated. What is the value of this C expression ?: 2 / 3 / 4 + 5 Answer:  You can't tell unless you know the rules.
7 Associativity The associativity of an operator

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 / 23

Lecture 13 Arithmatic in C - Lecture13:ArithmeticinC...

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

View Full Document
Ask a homework question - tutors are online