1 given numbers make a new truefalse examples 10 20

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: e a new true/false Examples: 1.0 > 2.0, 5<10, 7.00001 >= 7.0, ... Logical (&&,||,...) (later in book: section 5.1) given true/false(s), make a new true/false Examples? TRUE && TRUE, FALSE || TRUE, TRUE && FALSE, FALSE || FALSE 4 Arithmetic Operators For all of math, C has just 5 basic, built-in arithmetic operators: (look for the fancy math functions (sin,cos,log, etc.) in libraries--math.h) + * / % Add Subtract, or negate Multiply Divide Modulus ! ew N 5 A New Arithmetic Operator: % % computes the remainder after the first operand is divided by the second. Examples: (5 % 2) is 1, and (6 % 3) is 0 Useful for making cycles of numbers: For an int variable `x', if x is: (x%4)is: 0 0 1 1 2 2 3 3 4 0 5 1 6 2 7 3 8 0 9 1 10 ... 2 .....
View Full Document

This note was uploaded on 10/05/2011 for the course COMPUTER S 110-1 taught by Professor Tumblin during the Spring '11 term at Northwestern.

Ask a homework question - tutors are online