Continue Statement in c

continue statement is used in decision making such as if-else etc .continue statement is completely different from the break statement because continue statement doesn’t exit the loop if the condition is false, continue statement will jump controller again to the starting of the loop.

syntax:

continue;

flowchart:

how continue keyword works

working of continue statement:

continue keyword in c
# include
int main()
{
int i,x,sum=0;
for (i=1;i<=5;i++)
{
printf("enter %dst number ",i);
scanf("%d",&x);
if(x<0)
{
continue;
}
sum += x;
}
printf("the total sum is %d",sum);
}

output:

enter 1st number 1
enter 2st number 2
enter 3st number 3
enter 4st number 4
enter 5st number 5
the total sum is 15