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

Syntax-continue;

Example-
use of continue in while loop

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

Output-
Counting from 1 to 10
1
2
3
4
5
6
7
7
7
..... Upto infinity.
User break (keyboard)
ctrl+break

No comments:

Post a Comment