C program to display use of break statement in loop.

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

Comments

Popular posts from this blog

C Language Topics in Hindi and English

C language IMP Questions for BSc/BA/BCom/BCA/BE/BTech/MSc/MCA (CS/IT) I year students