Continue statement in c programming
******************************************************
Continue statement is used inside loops in c programming, when a continue statement is encountered inside a loop, control jumps to the beginning of the loop for next iteration, skipping the execution of statements inside the body of loop for the current iteration.
Continue in do-While loop
#include <stdio.h>
int main()
{
int j=0;
do
{
if (j==7)
{
j++;
continue;
}
printf("%d ", j);
j++;
}while(j<10);
return 0;
}
*********************************************************
Output:
0 1 2 3 4 5 6 8 9
******************************************************
Continue statement is used inside loops in c programming, when a continue statement is encountered inside a loop, control jumps to the beginning of the loop for next iteration, skipping the execution of statements inside the body of loop for the current iteration.
Continue in do-While loop
#include <stdio.h>
int main()
{
int j=0;
do
{
if (j==7)
{
j++;
continue;
}
printf("%d ", j);
j++;
}while(j<10);
return 0;
}
*********************************************************
Output:
0 1 2 3 4 5 6 8 9
No comments:
Post a Comment