CSC209H5 Chapter Notes - Chapter 2: Switch Statement, Logical Disjunction

18 views3 pages

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 ) {

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents