UNCONDITIONAL CONTROL STATEMENTS

UNCONDITIONAL CONTROL STATEMENTS :
       Unconditional control statements are......
                                                                 1) break 
                                                                 2) continue
                                                                 3) goto 
1) THE break STATEMENT : 
                                              The keyword break allows the programmers to terminate the loop.The break skips from the loop or block in which it is define.The control then automatically goes to first statement after the loop or block.The break can be associated with all conditional statements.
                                              We can also use the break statement in nested loops.If we use the break statement in the innermost loop then the control of the program is terminated only from the innermost loop.
2) THE continue STATEMENT :
                                              The continue statement is exactly opposite to break.The continue statement is used to continue next iteration of loop statement. When it occurs in the loop,it does not terminate,but it skips the statements after this statement.It is useful when we want to continue the program without executing any part of the program.
3) THE goto STATEMENT :
                                             The statement does not require any condition.This statement passes control anywhere in the program,i.e,control is transfer to another part of the program without testing any condition.The user has to define the control statement as follows.
goto label;
where the label name must be start with any character.
Where label is the position where the control is to be transferred.
programs :
break:
#include<stdio.h>
#include<conio.h>
main()
{
                 int i=1;
                 while(i<=10)
                 {
                      if(i>4)
                      break;
                      printf("%d",i);
                      i++;
                 }
printf("%d",i+10);
}
OUTPUT :123415
continue :
#include<stdio.h>
#include<conio.h>
main()
{
                 int i=0;
                 while(i<100)
                 { 
                      i=i+2;
                      if(i>40&&i<60)
                      continue;
                      printf("%d",i);
                 }
}
OUTPUT :246........
goto :
#include<stdio.h>
#include<conio.h>
main()
{
                 int x=1;y=10;i=10;j=1;
                 abc;
                 if(x<=i&&y>=1)
                 { 
                      printf("%d %d",x,y);
                      x++;
                      y--;
                      goto abc;
                  }
getch();
}
OUTPUT :
1   10
2    9
3    8
4    7
5    6
6    5
7    4 
8    3
9    2
10  1