-
Notifications
You must be signed in to change notification settings - Fork 0
/
input.txt
67 lines (57 loc) · 1.04 KB
/
input.txt
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
// * Example program computing the Fibonacci sequence and some other operations
int[8][3] fibonacci;
void p() {}
int f(double r, int e) {
double real;
char c;
int result;
real = r * 10.0;
c='0';
if (e < 256) {
c = (char)e;
result = (int)c;
}
else
result = (int)real;
return result;
}
void initialize() {
int i;
fibonacci[0][0] = 0;
fibonacci[0][1] = 1;
fibonacci[0][2] = 1;
i = 1;
while(i < 8) {
fibonacci[i][0] = fibonacci[i - 1][1];
fibonacci[i][1] = fibonacci[i - 1][2];
fibonacci[i][2] = fibonacci[i][0] + fibonacci[i][1];
i = i + 1;
}
}
void main(){
int i;
int j;
char ch;
p();
i=0;
ch = '0';
// * Shows 48 (decimal value of '0')
write f((double)i, (int)ch);
write '\n';
f(1.3, 2);
initialize();
i = 0;
while(i < 8) {
// Shows the Fib sequence, from 1 to 8 (34)
write '(';
write i + 1;
write ')';
write fibonacci[i][0];
write '+';
write fibonacci[i][1];
write '=';
write fibonacci[i][2];
write '\n';
i = i + 1;
}
}