codescracker


c

C continue Statement



« Previous Tutorial Next Tutorial »


In C language, the continue statements work just opposite to the break statement. That is, instead of forcing termination, continue forces the next iteration of the loop to take place, skipping any code remains after the continue statement. Let's go through the following program to understand the continue statement.

C continue Statement Example

Here is the example program that uses the continue statement in C programming.

/* C continue Statement Example 
 * This program illustrates
 * the concept of break statement in C
 */

#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
void main()
{
	int i;
	int num = 2;
	clrscr();

	for(i=1; i<50; i++)
	{
		printf("%d * %d = %d\n", num, i, num*i);
		if(i>0 && i<10)
			continue;
		else
			printf("\npress any key to exit..\n");
			getch();
			exit(1);
	}

	getch();
}

This program also prints the table of 2. Here is the sample output of above continue statement program in C language.

c continue statement

« Previous Tutorial Next Tutorial »








Tools
Calculator

Quick Links
Signup - Login - Give Online Test