-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path6_LoopSts.c
More file actions
58 lines (43 loc) · 867 Bytes
/
6_LoopSts.c
File metadata and controls
58 lines (43 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <stdio.h>
int main(){
/*
Loop Control Instructions:
To repeat some parts of the program
Types:
for,while,do while
i++ use,then increase
++i increase,then use
*/
//For loop
/*for(int i=1;i<=5;i++){
printf("Hello Arpita..!\n");
}
//While Loop
int i=1;
while(i<=5){
printf("Hello\n");
i++;
};
//do while loop
int i=1;
do{
printf("%d\n",i);
i++;
}while (i<=5);
//Break Statement : exit the loop
for(int i=1;i<=5;i++){
if(i==3){
break;
}
printf("%d\n",i);
}
printf("end");*/
//Continue Statement : skip to next iteration
for(int i=1;i<=5;i++){
if(i==3){
continue;//skip
}
printf("%d\n",i);
}
return 0;
}