CHAPTER OUTLINE
5.1 Introduction
5.2
The i f Statement
5.3 The
if-else Statement
5.4
Nested if-else Statement
5.5
The break Statement
5.6 The continue Statement
5.7 The goto Statement
5.8 The
switch Statement
5.9 Nested switch () Case
5.10
The switch () Case and Nested ifs
Exercises
5.1 INTRODUCTION
A Program is nothing but the execution of sequence of one or more instructions. In the monolithic
program the sequences of instructions are executed in the same order as they appear in the program.
Quite often it is desirable to alter the sequence of the statements in the program depending upon
certain circumstances. In practical applications there are a number of situations where one has to
change the order of the execution of statements based on the conditions. This involves a decision
making condition to see whether a particular condition is satisfied or not. On the basis of applications
it is essential.
=> To alter the flow of a program.
=> Test the logical conditions.
Control the flow of execution as per the selection.
These conditions can be placed in the program using decision-making statements. C Language
supports the control statements as listed below.
a) The i f statement
b) The i f - e 1 s e statement
c) The if - e l s e - i f ladder statement.
d) The sw itch () c a s e statement.
The decision-making statement checks the given condition and then executes its sub-block. The
decision statement decides the statement to be executed after the success or failure of a given condition.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.245.140