CSC209H5 Chapter Notes - Chapter 2: Switch Statement, Logical Disjunction
Document Summary
Csc209h5s - software programming and tools (winter 2018) Example int main() { return 0 ; if ( 3 > 0 ) { } else { printf ( "3 is greater than 0. print ( "condition is false. The if statement checks the conditions to run the code. Take two values and produce a boolean value. For the if statements, if you need to add more arguments to check, use one of these: && - logical "and" operator if (num >= 0 && num <= 5 ) { printf ( "num is a value between 0 and 5" ); || - logical "or" operator if (num_one >= 0 || num_two >= 0 ) { printf ( "one of the numbers is a positive number" ); Rather than having multiple if statements, you can use an else if to check for the next condition. #include int main() { double gpa = 3. 0 ; if (gpa < 0. 0 ) {