27.04.2021 Views

Yashavant Kanetkar - Let Us C-BPB Publications (2016)

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Multiple Statements within if 45

The if-else Statement 47

Nested if-elses 49

Forms of if 50

Summary 51

Exercise 51

4. More Complex Decision Making 57

Use of Logical Operators 58

The else if Clause 61

The ! Operator 66

Hierarchy of Operators Revisited 66

A Word of Caution 67

The Conditional Operators 69

Summary 71

Exercise 71

5. Loop Control Instruction 81

Loops 82

The while Loop 82

Tips and Traps 85

More Operators 88

Summary 90

Exercise 90

6. More Complex Repetitions 95

The for Loop 96

Nesting of Loops 101

Multiple Initializations in the for Loop 102

The break Statement 102

The continue Statement 104

The do-while Loop 105

The Odd Loop 107

Summary 109

Exercise 110

7. Case Control Instruction 117

Decisions using switch 118

The Tips and Traps 121

switch versus if-else Ladder 126

The goto Keyword 126

viii

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!