Unlike break statement, Continue statement is used to jump the control out of the loop, it is sometimes required to skip some part of the loop and to continue the execution with next loop iteration.
Continue statement used inside the loop helps to bypass the section of a loop and passes the control to the beginning of the loop to continue the execution with the next loop iteration.
The Syntax of Continue statement
Let us see the program given below to know the working of the continue statement.
Write a program to print first 20 natural numbers skipping the numbers divisible by 5
/* Program to print first 20 natural numbers skipping the numbers divisible by 5 */
if ((i % 5) == 0)
1 2 3 4 6 7 8 9 11 12 13 14 16 17 18 19
Here, the printf statement is bypassed each time when value stored in i is divisible by 5.