Syntax- break;
Use of break in 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++) {
printf("%d\n",i);
if (i==7) break;
}
getch();
}
Output-
Counting from 1 to 10
1
2
3
4
5
6
7
No comments:
Post a Comment