Syntax:
break ;
Flowchart:
Program:
#include <stdio.h> |
When the above code is compiled and executed, it produces the following output
| Value of a : 10 Value of a : 11 Value of a : 12 Value of a : 13 Value of a : 14 Value of a : 15 |
The continue statement in C program works somewhat like the break statement. Instead of forcing termination, it forces the next iteration of the loop to take place.
continue:
Syntax:
continue ;
Flowchart:
Program:
#include <stdio.h> |
Value of a : 10 Value of a : 11 Value of a : 12 Value of a : 13 Value of a : 14 Value of a : 15 |
Syntax :
goto label_name ;
Flowchart :
|
// style 1 label_name: Statement 1; Statement 2; . . . if (any-test-condition) goto label_name; |
Note : here if any test condition is true , goto will transfer the
program's control to the specified label_name.
Program:
#include<stdio.h>
|
When the above code is compiled and executed it produces the following
output.
|
1 2 3 4 5 |
Style 2 : ( Transferring the control from
top to down)
|
// style 2 statements ; if (any-test-condition) goto label_name; statement 1; statement 2; label_name: other statements; |
Program:
#include<stdio.h>
|
When the above code is compiled and executed it produces the following output.
|
First run : Enter an integer number : 1 Number is 1 Hi!! Second run : Enter an integer number : 0 Hi!! |


No comments:
Post a Comment