C program to display use of continue statement in for loop.

Syntax- continue;

Example-
use of continue in for loop.

#include<stdio.h>
#include<conio.h>
void main(){
int i;
clrscr();
printf("counting from 1 to 10\n");
for (i=1;i<=10;i++) {
if (i%7==0) continue;
printf("%d\n",i);
}
getch();
}

Output-
Counting from 1 to 10
1
2
3
4
5
6
8
9
10

No comments:

Post a Comment