/
main_program
58 lines (51 loc) · 1.09 KB
/
main_program
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
class Program {
int testG, test_G_side;
int testG2;
boolean testGArray[10];
int testFactorial(int n) {
if(n == 1 || n == 0) {
return 1;
}
else {
return n * testFactorial(n - 1);
}
}
boolean testBooleanReturn(int b) {
boolean localA;
localA = false;
return localA;
}
void main() {
int localK;
int localB, localI;
int num;
localI = 3;
num = 5;
if(localI == 3) {
callout("printf", "Local variable assignment + Single if working!");
}
callout("printf", "Factorial of %d is: %d", num, testFactorial(num));
localI = num;
if(localI == 5) {
localI = 4;
if(localI == 4) {
localI = 1;
callout("printf", "Nested if working");
}
else {
callout("printf", "Nested else working");
}
}
if(localI == 2) {
callout("printf", "Never here!");
}
else {
callout("printf", "Nested else working");
}
for i = 0, i <= 6 {
callout("printf", "%d", testFactorial(i));
i = i + 1;
}
return;
}
}