DamnSchool
In some situations, we want to take the control to the beginning of the loop, bypassing the statements inside the loop which have not yet been executed, for this purpose the continue is used. When the statement continue is encountered inside any "C" loop control automatically passed to the beginning of the loop.

Continue statement

#include<stdio.h>
void main()
{
int i,n,sum=0;
for(i=1;i<=5;i++)
{printf("Enter any number\n");
scanf("%d",&n);
if(n<0)
continue;
else
sum=sum+n;
}
printf("sum is %d",sum);
}

Run Example >

< Previous Next >

Privacy Policy Terms of Service About
Creative Commons License
This work is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International License.