continue statement in for loop

C Programming Language Loop control in C Language (Article) Loop control in C Language (Program)

932

Program:

#include <stdio.h>
void main ()
{ 
int a =  1; 
 
while( a <= 10){ 
	 	
 	if(a == 5){ 
 	  a++;
      continue;
	 } 

 printf("value of a: %d\n", a);	
 a++; 	  
} 
 
}

Output:

value of a: 1
value of a: 2
value of a: 3
value of a: 4
value of a: 6
value of a: 7
value of a: 8
value of a: 9
value of a: 10
Press any key to continue . . .

Explanation:

when the value of a reaches to 5 then its continue, for that 5 is not printed.

This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.