break and continue statement
//program with continue
#include<stdio.h>
#include<conio.h>
int main()
{
int i;
for (i=1;i<10;i++)
{
if(i==5)
{
continue;
}
printf("%d\t",i);
}
getch();
}
output:
here 5 is loss due to continue,it does not print 5 because it goes to increase the value of i by i++
//program with break
#include<stdio.h>
#include<conio.h>
int main()
{
int i;
for (i=1;i<10;i++)
{
if(i==5)
{
break;
}
printf("%d\t",i);
}
getch();
}
output:
here after finding the 5,for loop is end.
Other C Programming:
C programming beginner from Hello World
Keywords in C programming
Program for Stack Using switch( PUSH POP DISPLAY and empty
Queue Implementation
Matrix Row sum , column sum and transpose
Program that uses pointers to copy an array of double
Break and continue statement
C program for tower of hanoi
Infix into postfix
Keywords in C programming
Program for Stack Using switch( PUSH POP DISPLAY and empty
Queue Implementation
Matrix Row sum , column sum and transpose
Program that uses pointers to copy an array of double
Break and continue statement
C program for tower of hanoi
Infix into postfix
Post a Comment