CSE 123C.001 2-4-08

# CSE 123C.001 2-4-08 - CSE 123C February 4, 2008 Arithmetic...

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

CSE 123C February 4, 2008 Arithmetic operators o Addition  + o Subtraction  - o Multiplication * o Division  / o Modulus % Gives you only the remained of two integers Example 5 % 2 returns a value of 1 Helpful when trying to compute binary representation Integer division o Division between two integers results in an integer o Result is truncated not rounded 5/3 is equal to 1 3/6 is equal to 0 o Integers do not include decimal points o Example int x=5 double y =3 (defined as 3.0 since it is a double) y/2 = 1.5 y/2.0=1.5 All because y is declared as a  double which includes decimal points

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

View Full Document
Mixed operations o Done between data of different types o Lower type is converted to higher type Int is converted to double, etc. Priority of operations o Parentheses (inner most first) o Unary operators (+ -) (right to left) Unary means what is negative and what is positive o Binary operators (* /%) (left to right) o
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 04/08/2008 for the course CSE 123c taught by Professor Elkarboutly during the Spring '08 term at UConn.

### Page1 / 4

CSE 123C.001 2-4-08 - CSE 123C February 4, 2008 Arithmetic...

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

View Full Document
Ask a homework question - tutors are online