Read OnLine C- Program Example

04_LOOP CONCEPT (04_BREAK,CONTINUE)
PRAC 1 PRAC 2
//wap to print 1to4
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
clrscr();
for (i=1;i<=10;i++)
{
if (i==5)
{
break;
}
printf("%d \n",i);
}
getch();
}
------output------
1
2
3
4
//wap to print 1 to 10 & continue from 5
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
clrscr();
for (i=1;i<=10;i++)
{
if (i==5)
{
continue;
}
printf("%d \n",i);
}
getch();
}
1
2
3
4
6
7
8
9
10
Previous Next
Download Download