Dca1102-Programming in C - de Unit 4
Dca1102-Programming in C - de Unit 4
Hello and welcome to the session. In this session, we will see several control statements that enable
us to specify the flow of program control meaning the order in which the instructions have to be
executed. Control statements make it possible to make decisions such that, the tasks are performed
either repeatedly or makes or allows the control to jump from one section of code to another. In this
session, we will see how to make use of several two-way or multi-way path decisions, such that the
flow of execution of statements can be controlled and also how to jump from one section of code to
the other section by using Unconditional Branching meaning without any condition.
And we will also learn how to evaluate the conditional expressions. So we have several types of
control statements which are decision-making and branching statements. The flow of execution of
instructions can be controlled either conditionally or unconditionally. Based on the context, we can
choose either of these statements. For example, we can use a selection statements such as if
statement or a conditional operator statement, we can choose a multiple decision making
statement, which is if else statement or we can choose a multi way switch statement or we can use a
jump statement like goto statement.
So based on the context, we can choose either of these statements. So we have a very simple
decision making statement which is, used in most of the programs, which is if statement this is a
conditional branching statement where if the condition is true, then the, control flow of the
statements is modified. So here, in the example, if you can see if is followed by a condition, which is
a relational expression, (a>b) so if the condition here is true, then the statement is executed. If the
condition is false, then the statement will not be executed. This is this Syntax of if statement, we use
if keyword, which is followed by a test expression which is included in a parenthesis. Now the test
expression has to be included in parenthesis.
Then we have a statement. Now this statement can be any statement. We can either have a single
statement like this, in which case we do not use or we need not use open parenthesis and open
brace and closed brace. We can also have multiple statements this way, where we, in case we are
including multiple statements then we have to use these statements inside a block within open
brace and closed brace. So in case we're using a single statement, we do not have to use open brace
and closed brace. If we're using multiple statements, then we have to use open brace and closed
brace. Now, this test expression can be any relational expression or can be any statement as well.
Let us observe how this if statement works. If statement can be used anywhere in the program
having said that, if statement can be used anywhere in the program, then it is obvious that there are
several programs statements before if statement. And there are several, executable statements
after the if block as well. So, we have to observe what happens to the control flow if the test
expression of if is true. And what happens if the test expression of if is false.
So, in the first case, where expression is true, we have initialized a variable which is called as test,
which is initialized to value 5. Now if is the keyword that we would be using now here, we're doing a
condition check. This is a test expression, which is a relational expression where we are checking if
the value of test<10. The value of test is five and it is <10. So the condition will yield a true value. So
in case the expression or the test expression is true, the control will be taken inside the if block. So
the control will be jumped inside the if block and all the statements inside the if block will be
executed, you might have a single statement or you can have multiple statements. Whichever how
many of a statements are all the statements will be executed because the control will be, taken
inside the if block. Now, in case the test expression is false, where we have test being initialized to 5.
So here in the test expression of if we're checking if test>10, the value of test here is 5, 5>10 is false.
So the condition here will yield false value. In this case, the control will be jumped on to the
immediate statement after the if block. So the control will never get inside the if block, but the
statement immediately after the If block will be executed.
Let us see a program where we are using a simple if statement. The program is to display a number if
it is negative. So how are negative values checked? How do we check if the number is negative or
not? Any number which is <0 will be a negative number. So here, the first thing in the program that
we're doing is we're initializing a variable num to integer. And we are displaying a statement through
a printed statement saying enter an integer. So, where the user can enter value. Now that value has
entered has to be checked if it is positive or negative. So the number the user enters or the value
user enters will be read through scanf statement and will be stored in the variable num through the
address operator. Now here is where we are using this if statement where num<0 is the condition.
Now, num is the same variable where the users entered value will be stored. Now suppose I enter an
integer 10. 10 is a positive number, So 10 is checked whether it is <0 or not. So 10 is <0 is a false
statement. It is a false value. So the control will be directly jumped onto the statement after the if
block, which is a printf statement. Now in the printf statement, the if condition is false. So this string
will be displayed on to the console where that if condition is false. But the possibility is user might
also enter a number which is negative number, in case the user enters a value which is <0, then the
program has to display the value.
So if we run the program again in that case again, when the user is asked to enter a value if I enter -
5, that -5 will be read again and that will be stored in the variable num, and next time it checks the if
condition where -5<0 will yield a true value. When the value is true or the condition is true, then the
statement, the control is jump into the if block where we have a printf statement which says you
entered “%d”, num. Now the num value here that you have entered is -5. So this num value will be
returned to the format specifier “%d”. So the statement that would be displayed onto the console is
you entered -5.
Now we have if else statement, which is just an extension of a simple if statement. So many times
we use if statement in a program to perform certain action based on whether the condition is true
or false. But we might also come across a situation where in we perform certain action, say action 1.
If the condition is true and perform another actions say action 2 if the condition is false as well. So in
such cases we use if else statement. So this Syntax of if else statement is the test expression of if
statement will be checked. If it is true, then statement 1 is executed. If it is false, then statement 2
that is a part of else will be executed. Now you can have 1 single statement in an if block or you can
have multiple statements in an if block, the same is true with else as well. You can have a single
statement associated with else block or you can have multiple statements in else block.
So if we observe the working of if else statement based on whether the condition is true or false,
then in the first condition where the expression is true now here, test value is initialized to 5. Now,
the condition 5<10 is true. So the condition is true here. So when the condition is true, then the
control will be passed on to the statements inside the if block. So all the statements inside the if
block will be executed. Now, once the control reaches the end of if block, the control will be jumped
to the statement after the else block, so the control will never be passed on to the else block here.
Now, in case the expression is false, then the control will be directly jumping to else block and the
statements inside the else block will be executed and after the control reaches the end of else block,
the control will be jumped onto the statement next to else block. So this is how the if else statement
works.
So let's see a simple program which demonstrates if else statement the program here is to check
whether the number is odd or even. Now the simple logic behind the program is to divide the given
number by 2. So if the remainder is 0, then the number is even number. If the reminder is non 0,
then the number is odd number. So to do that, we have taken a variable num which is used to store
the value that user enters. So you are displaying a statement here saying enter a number onto the
output console. The user will enter a value. In this case, it is 10. That value will be stored in the
variable num. So num will be equal to 10 now. So here we have if condition next num module is to
will perform, division by 2 and gives the remainder. So num is divided by 2 here, which is 10÷2 is 0.
So because the condition is true, the next statement inside the if block will be executed.
Here the statement inside the if block is printf “%d” is an even number; “%d” is the format specifier,
so it must have an argument. So here the argument is num, which is a variable. So a value of variable
num is 10, so 10 would be returned to the format specifier here. So onto the console the statement
that is displayed is 10 is an even number. Now if at all, the user enters a number 11, then the
condition if condition will be false because 11÷2, is the reminder is not 0. So the control will jump
onto the else block where again we have a display statement which is printf which displays “%d” is
an odd number, num. Now the value of num is 11, so 11 will be returned to the format specifier. So
the statement, which is displayed onto the console is 11 is an odd number.
Now this program demonstrates Nested if statements. Nested if statements are nothing but we can
nest if else blocks inside If else blocks. Now, here in the program, we are taking two variables which
are num1 and num2 declared to be integers and we are simply entering values to it. Now, this
program basically compares the value whether two numbers have greater than or equal to or equal
to or less than each other. Now we have a first if statement where two values are compared,
whether greater than or equal to or not. Now, if the condition is true, then the control will be
jumped inside the first if block, which is this if block. Now here, the first statement that we can see is
if condition again. Now, here the values are checked whether they're equal to or not. Now, in case
this condition is true, the control will be jumped inside this if block and the statement result “%d”
equal to “%d”, i.e. num1 and num2 values will be displayed on to the console.
Now, in case this condition is false, that is the second if condition is false, then else part inside the if
block will be executed. Now, in case the outer if condition is false, then the control will be jumped
on to that outer else block. And then the statements are, printf statement, which is inside the else
block will be executed. So the numbers are being compared, whether they're greater than or equal
to or not, in case the numbers are greater than or equal to then they are checked, whether they are
equal to or not, in case they are not equal to also then the result says the numbers are less than
each other. Nested if else statements can be quite confusing, and also we cannot every time use
multiple if else statements, which is usually a two way approach. So in case we want to use a multi
way decision making statements.
Switch statement is the better statement that we can use. So among all the alternatives, switch
statement is the statement which allows the user to use one code block. Here in the Syntax of switch
statement, the keyword switch is used, which comes along with the expression. Now the expression
here can be an integer expression which can yield a integer value or it can also have a character
constant value. Now here, the switch block consists of many case statements. Now each case
statement will have different constant values. Now, this constants can also be integer values or
character values. Integer value means we can have 1, 2, 3 or character constant values, which are a,
b, c etc.
Now, firstly, the expression of switch will be evaluated. And that value will be matched among the
case values which are provided here. That means if the expression value is 1, the 1 is matched with
all the constant values of the cases which are provided here. Now, if there is a match with the const
case constant value, then that statements which are followed with that case will be executed. And
each case has to be ended with break statement such that after executing the right case statements,
others case statements will be dropped.
So what this break statement does is it terminates the execution of all the statements after break
and then comes out of the block. Now, in case there is no match with the expression and the
constant values of cases then the default case is executed. So the flow of a switch statement must
be firstly, we should begin with the switch expression. Now, once the switch expression is evaluated
here the constant value against the case 1 will be matched. If there is a match, then the statements
are, statement 1 here statements of that case 1 will be executed and directly goes to the end of the
switch by skipping all other case statements. Now, in case there is no match between switch
expression and case 1, the control will be taken to case 2.
So if there is a match with the value expression value and case 2 value, then those statements that
this case 2 statements will be executed and again we reach the control will reach end of the switch,
by skipping all the other case values. So this goes on until, the value is matched with all the case
values or case constant values here. If there is no match once there is a right match, then those
statements will be executed and we reach the end of the switch. If we don't, in case there is no
match with any of the case constant values, then the control will jump to default statement. All the
statements in the default case will be executed, and then the control reaches end of the switch.
Here is a simple switch case statement to demonstrate how switch case statement works. We have
taken integer value “I” here, which is 4, which is initialized to 4. And that value is passed in the
switch expression here. Now, this expression value will be matched against all the cases here and
those statements where there is a match those statements will be executed. Now, here there is no
match with the case constant values of 1, 2, and 3 as the value of “I” is 4. Now, case 4 will be
matched as it matches with the value of “I”. Now the control executes all the statements with in that
case, there is only one single statement, which is a display statement which prints case 4 onto the
output console and that is displayed onto the output.
Now, at the end of the case there is break meaning, the statements after the break will be
terminated and directly jumps to the statement after the switch so it reaches the end of switch. So
there are two statements after this break which is default and printf. Those statements will not be
executed. This is basically to avoid only that particular case where there is a match and all those
cases will be skipped where there is no match. And as the program reaches the end, the output case
4 will be displayed on to the console.
Here is an example for that, so here we have included goto statement in if condition. So this
program demonstrates the conditional branching of a goto statement. So a condition is checked
here if this condition is true, then goto statement of if part will be executed and it jumps on to the
particular label. The label here is called display, so the control is jumped on to display label and the
output will be displayed. And are the any statement of that display along and followed by that label
will be executed. If the condition is false, then we have a else block the control will be jumped onto
the else block and then here goto will be executed and then again, the control will jump on to
display label to execute the statement following it.
We now have a conditional operator which is also called as a ternary operator, which uses question
mark and colon as its operators to evaluate three expressions expression 1, expression 2 and
expression 3 which also can be assigned to a variable. So this syntax of the conditional operator
looks like this, we have a variable equal to expression 1 followed by a question mark, followed by
expression 2 followed by a colon, followed by expression three. Firstly, first expression, expression 1
will be evaluated here in the example in this case, (x>y) will be evaluated. In case the expression 1
yields true value then the statement or expression after question mark will be evaluated in case the
condition yields false value, the expression after the colon part will be evaluated. So here, in the
example, if (x>y), if it is true, then “x” will be evaluated in case if it is false, then “y” will be evaluated.
We have reached the end of decision.
Thank you.
Hello and welcome to the session. At times it is needed that in a program we would want to execute
certain set of statements for a certain number of times. Now, this can be done in C programming by
using looping control statements. Now, what looping control statements does is upon ah base
condition. It will run body of statements for certain number of times. So in this session, we will learn
how to check a condition before and after a iteration that is, a body of loop, repeating itself for a
certain number of times and how to exit from the loop based on certain conditions and how to use
break and continue statements.
As we understand that looping control statements are used to repeat ascertain set of statements
under until a condition is met. We have three kinds of looping statements which are while, do while
and for among these while and for loops are called us entry level loops, whereas do while differs a
bit with while loop.
While loop is simplest among all the other looping control statements. The syntax of while Loop
consists of a while keyword and followed with a test expression. Firstly, the test expression would be
evaluated. If the test expression is true, then the body of while loop will be executed. That is, the
statements inside the while loop will be executed. After the execution of the statements, the control
will be taken back to the test expression again. Again, the expression is evaluated and if it is true,
once again the body of loop will be executed. The process will be repeated until the condition is
false. Once the condition is false, the control will be transferred to the next statement after the
while loop. The flow of while loop can be observed as we have a test expression first and that test
expression will be evaluated. If the two possibilities of test expression are it might be true or it might
be false. If the expression gives a true value then the body of while loop will be executed. If it is
false, then the statement after the while loop will be executed.
Let us see a small program where the working of while loop is demonstrated. Inside the main
function where the execution begins. We have a first statement as int i=1 where i is an integer
variable, which is assigned to 1. Next we have a while statement followed along with the condition
which is i<=5. Here i value is 1, 1<=5 is checked. The condition is true because the condition is true.
The control is transferred inside the body of the loop. We're in the first statement here is a display
statement, which is a printed statement which displaced the value of i. Once it displaced the value of
i value 1 will be displayed on to the output console. The next statement after printed statement is
++i, which increments the value of i so that now the value of i will be as 2. So the current value of i
will be stored as to now, after executing these two statements in while control will get back to the
condition of while again which is i<=5 now, as the current value of i is 2<=5 is checked 2<=5 is true.
So again, the control is transferred back to the body of the loop wherein the value 2 will be displayed
using the printed statement.
And the value of i will be incremented which will be 3. Now 3 will be compared with 5. Again, the
control enters the while loop 3 will be displayed on to the console 3 value will be incremented which
is 4, 4 will be compared with 5. The value4 will be displayed on to the output console 4 is
incremented to 5 with the help of ++i statement 5 is compared with 5 again because 5 is equal to 5
again, the control will be transferred inside the while loop, where the value 5 will be displayed on to
the console i value will be incremented to six now. Now the control will be passed on to the
condition again. Now condition here is checked again with the new value. Now, 6 is compared with
5, which is a false value because 6<=5. So the condition yields false. Upon false the control is
transferred now to the statement after the while loop, which is a return 0. So this is how the while
loop works for certain number of times until the condition is met.
In a while loop the test expression gets checked before the body of the loop gets executed. Only if
the test expression is true, then the body of the loop will be executed. That means to say that the
control is never transferred inside the body of the loop if the condition is false. But sometimes we
may want the body of the loop to get executed before the test expression is evaluated or executed.
In such cases, we use do while loop where it is similar to while loop with a difference that the body
of the loop gets executed before the test expression is evaluated.
So we have a syntax of do while loop wherein we have do keyword along with a block of statements
which are to be executed, which are followed by while statement along with a test expression. So to
show the flow of do while loop. Firstly, the control enters the loop body that is do while loop body
executes all the statements once after executing it checks the test expression of the while
statement. If the test expression is true, the control is transferred back to the do while loop body. If
the test expression is false, then the control is transferred to the statement after the while.
So, this program here shows us how to implement do while loop in the program. The first
declaration statement here declares a variable i and assigns a value 10, after which the control is
directly passed on to the do loop execution. Now here there is no condition which is checked before
do. So, the statements inside the do loop will be executed. The first statement here is a printf
statement which just prints of value i onto the console. The current value of i is 10 that would be
displayed onto the console. Then, after which the value of i will be incremented. After incrementing
the value, the control comes out of the do loop and then the control is passed on to the while loop.
While statement now here in the while statement, the condition is checked, which is i<20.
The current value of i will be compared with 20. If the condition is true then the body of the loop
gets executed again. So that the control is transferred back to do loop where the value of i would be
displayed. Now, as the value was incremented here, the value now would be 11. Now the control is
gets back to the while statement the condition is checked, goes back to do loop execution. Now this
process is repeated until the condition is false, that is, till 19 is less than 20 till the value is 19. The
values are displayed on to the output. Once, the i value becomes 20 the condition becomes false and
the loop execution stops.
For loop is the looping control statement which is mostly used in many of the programs. Now the
advantage of having a for loop is that the initialization, the test condition and increments are all part
of a single statement. Unlike while or do while where initialization is first done. And then we check
the condition in the next statement, and then we increment or decrement inside the loop. So this
hassle is not there with a for loop, wherein it provides the initialization, test condition and increment
parts in a single statement. Now, this makes the first statement very flexible as well as very powerful
and because of this, this is the most used statement in C. And we can also have constructs an
iterative loop with the help of for loop. The syntax of for loop consists of for keyword followed by 3
set of expressions expression 1 expression 2 and expression 3 which are separated by semi colon
that is terminators. And, this for loop will consists of body of Statement or statements. Now, in these
three expressions, expression 1 is for initialization, expression 2 is for test condition, expression 3 is
for increment or detriment operator.
So, if we look at the execution process of the, for loop Firstly, as we have initialization expression in
the, for loop, we must have a control variable which is already declared. We assign a initial value to
it. So, for example, if we take a control variable to be i must be initialized with certain value. Now,
next the control will jump on to the test condition and checks if the condition is true or false. Only if
the condition is true, then the body of the loop is executed. Otherwise the body of the loop will not
be executed. After executing the body of the loop, the control will jump on to increments or
decrement operators where we adjust a value of control variable. Now, after which the condition is
checked again and then the body of loop would be executed. Now this process is repeated until the
condition is false.
This is a very simple program to demonstrate the for looping. So here we have a variable which is
assigned as integer. We have not given any value here because we will be using this as a control
variable in a for loop. So there is no necessity of initializing as well because for allows us to initialize
a value as a part of it's a statement. So here i am assigned a value to 1. So this is the initial condition
of i. Now the control will be passed on to the next expression, expression 2 which is a condition. So I
will be checked and compared with 11 now, as i value is 11 is less than 11, which is true. So now the
control will be transferred to the body of the loop where we are displaying a statement.
Remember that we have not gone to the expression 3 yet. We just have checked the initial
condition. We have tested the condition and then we have come to the body of the loop. Now here
the body of the loop is just displaying the value of i. So i being 11 am displayed onto the console.
Now the control is transferred to the increment is decrement expression. Here we are pre-
incrementing the value of i, so the value of i will be incremented to 2. Again from here, the control
will be passed on to the test expression 2 will be checked or compared with 11. 2 is less than 11, so
the value the control enters the body of the loop and the value of two will be displayed. Then again,
the control will be transferred to the increment decrement operator. So we have in a pre-increment
here, the value will be incremented to 3, 3 will be compared with 11. So, in the same way, we display
all the values still 10. Now, after the 10th iteration, the value of i will be incremented to 11. Now, 11
are compared with 11 here. And because 11 is not less than 11, the control comes out of the for loop
and passed on to the statement after the for loop, which is a return zero.
Here is a program which calculates sum of n numbers by using a, for loop. Basically sum of n
numbers is we enter a value for n and this program must calculate the sum of all n numbers for
which we are declaring three variables numb count, and sum is equal to zero. So here, numb is a
variable through which we ask the user to enter a value count is the variable, which will be using as a
counter sum is a variable, where will be calculating the sum of n numbers Now the next statement is
a printf statement which displays the statement, enter a positive number so upon which the user
will enter a value 10. That means user wants to calculate sum of 10 numbers. Now the 10 value will
be read through scanner statement and will be located at the variable num located into the variable
num. Now we have next a for loop which has a counter variable, and it is initialized to 1. Now, the
counter variable 1 is compared with the value that the user has entered, which is num.
So here it would be 1<=10. Because 1<=10, the condition is true. So the control will be transferred
inside the for loop Where will be calculating the sum. Now we have a statement sum+=count, which
is similar to sum=sum+count. Now the initial value of sum is 0 + count value is 1 then 0+1 is
calculated where we get 1, now the sum value or the new value of sum is 1, which will be stored.
Now the control executing this statement, the control will be jumped or transferred to ++ count
where the value of count will be incremented. The value of count now is 2, now the control is
transferred to the condition here 2<=num. That is num value has never been manipulated, so it is
not changed. Only count and sum values are manipulated here.
So we have to keep track of count and sum variables. Now count value here is to 2, 2<=10 which is
true. So again the control will be transferred inside the for loop where sum will now be the new
value of sum plus the new value of count. Now, once you calculate sum + count, we get another new
value, which is currently that means the current value will be stored in the place of sum. So in this
way we keep executing the statement sum+=count until count is less than or equal to num. Once
count less than or equal to num becomes false. The control is transferred to the statement, which is
after the for loop, which is a printf statement.
So this prints or displays the current value of sum which is 55 here we also have a nested for loops
wherein we have inner for loop and outer for loop. Now, for each iteration of an outer loop, the
inner loop will be executed until it is done again. The control is passed back to the outer for loops to
check the condition again; the inner loop is executed until its iterations are done. So these two for
loops must have two different control variables to execute. This is how we can include a nested for
loops in the program. Here, the first statement int n, i, j declares three variables as integers. Then we
have a clear screen function basically to flush out all the data from the output screen.
Then we have a printf statement where the user is asked to enter a value for n, and the same value
is read in to the variable or to the location where n is located. Then we have outer for loop here,
which we have to focus on where the initial condition of the control variable i is 1, and we have a
condition i<=n then ++i now upon the condition which gets satisfied or if the when the condition is
true, the control is transferred inside the for loop. The first statement inside the for loop is a printf
statement which prints the value of i.
So here is that value which will be displayed, which is i=1. Then we have inner for loop here. Now
this inner for loop has a different control variable which is j=1. Now we check if 1<=10, if 1<=10 then
the control will be transferred inside the inner for loop which displays the statement which displays
the value of j. Now \t here is to use one tab space now, this displaces the value of j here is currently
is 1 because it has not been manipulated yet. So here 1 will be displayed.
After displaying the control will be passed to the increment operator of the inner for loop, where j
value will be incremented to 2 then 2 will be compared with 10 which is the condition of the inner
for loop. Now, after the condition is checked, the value of j will be displayed again. So here is where
the value of j is displayed again. So the inner loop runs here for 10 times. Now after inner loop
transferred 10 times, the outer for loop is not done yet. So the control will be transferred to the
outer for loops increment operator here. Now, after incrementing the value of i, the value of i will
now become 2 so 2 will be compared with n.
And then again the control will be transferred inside the outer for loop where the value of i will be
displayed as 2 and then inner for loop is run for 10 times. Then all the values of j would be displayed
for from 1 to 10. And then again the control is transferred back to the outer for loop increment
operator, i will be checked with the condition, 3 will be <=3, which is value n here. And then the
control will be passed inside the inner for loop where we display the value of i, which is 3 then the
control is passed on to the inner for loop, where we display the values of j from 1 to 10 and then the
control will be passed back onto the outer for loops increment operator. Here, the i value will
become 4. Then the condition is checked, which is 4<=3, which is false. Now the control comes out
of the for loop and then is passed on to the statement which is next to the outer for loop, which is
return zero.
The usage of break statement ends the loop immediately and all the statements after the loop are
executed, meaning all the statements after the break will be skipped. So here in the program, we
have used break statement inside the for loop with an if condition. Now here, as we know for loop is
used for number of iterations. So here, whenever x value becomes 5, the break statement is
encountered. After the break statement is encountered, the loop control comes out of the loop and
is transferred to the statement immediately after the loop. Now here the statement after the loop is
broke out of loop and it displays the state in a value of x where it says at x=%d. So the x value being
5, the output would be broke out of loop at x=5.
Here we can see how Break statement is used in different looping control statements. And what
happens if we use break statement in while, do while and for loops. In a while loop if we're using a
break statement, the loop is terminated immediately and the control will be transferred to the
statement after the while loop. If we're using break statement in a do while loop then loop is
terminated immediately after break statement is executed and control is transferred to the
statement after the while statement. Then, if we're using a break statement in a for loop again, the
loop is terminated and control will be transferred to the statement after the for loop.
Now the continuous statement skips the current iteration of the loop and then continues with the
next iteration. Now here we have a continue statement that is used when x=5. That is, if x is equal to
five. We have used a continue statement inside for loop. Now what it does is as we know, that here
the x value keeps incrementing. Whenever x becomes 5, that particular iteration will be skipped and
then it continues with the next generation. So we can see in the output there is a value 5 is missing,
whereas all the other values 12346789 10 are displayed onto the console.
Here we see a continue statement being used with different looping control statements. In the first
looping control statement, that is, while loop when we use continue, the current iteration will be
skipped and control will get back to the loop here. In a do while loop when we're using continue
statement, the current iteration is skipped again. The loop will continue with the next iteration. Even
in the for loop when we're using continue the current iteration will be skipped and control will get
back to the for loop with the next iteration. Thank you. As we have reached the end of the session