forked from CodeKul/C-Oct-2019-Weekday-4.30-5.30pm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathControlFlow.c
82 lines (69 loc) · 1.26 KB
/
ControlFlow.c
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include<stdio.h>
int main() {
int a = 20;
int b = 20;
int i = 0;
// if else
/*
if (condition) {
true statements;
}
else {
false statements;
}
*/
if (a < b) {
printf("a is less than b\n");
}
else if (a == b) {
printf("a and b are equal\n");
}
else {
printf("a is greater than b\n");
}
if (a < b) {
printf("a is less than b\n");
}
else {
if (a == b) {
printf("a and b are equal\n");
}
else {
printf("a is greater than b\n");
}
}
// Loops
/*
while(condition) {
statements;
incr/decr;
}
*/
while(i < 10) {
if(i % 2 == 0)
printf("Codekul - ");
else
printf("The Gurukul for Coders!\n");
i++;
}
/*
do {
statements;
incr/decr;
}while(condition);
*/
i = 30;
do {
printf("Codekul\n");
i++;
} while(i < 10);
/*
for(initialisation; condition; incr/decr) {
statements;
}
*/
for (i = 0; i < 10; i++) {
printf("Codekul\n");
}
return 0;
}