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

Syntax- continue;

Example-
use of continue in do..while loop

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