Cs112 - Programming Fundamental: Lecture # 16 - Jumping Statements in C Syed Shahrooz Shamim
Cs112 - Programming Fundamental: Lecture # 16 - Jumping Statements in C Syed Shahrooz Shamim
while(……..) do
{ {
......... .........
......... .........
if (condition) if (condition)
break; break;
......... .........
......... .........}
} while (…….);
......... .........
......... .........
Continue Statement
• Continue is used for skipping a part of loop for
some condition.
• Continue causes the remaining code inside a loop
block to be skipped and causes execution of jump to
the top of loop block
12 Print 1-10 numbers except 3 and 7
for(…………….)
{ #include <stdio.h>
.. . . . . . . . void main ()
.. . . . . . . . {
if (condition) int i;
continue; for(i=1 ; 1<=10 ; i++)
.. . . . . . . . {
.. . . . . . . . if ((i==3)||(i==7))
} continue;
printf(“ %d\t”, i);
} }
Continue Statement for while & do-while Loops
while(……..) do
{ {
......... .........
......... .........
if (condition) if (condition)
continue;
continue;
.........
.........
.........}
.........
while (…….);
} .........
......... .........
.........
goto statement