147
Christian Urban <christian dot urban at kcl dot ac dot uk>
diff
changeset
|
1 |
write "Input a number ";
|
Christian Urban <christian dot urban at kcl dot ac dot uk>
diff
changeset
|
2 |
read n;
|
Christian Urban <christian dot urban at kcl dot ac dot uk>
diff
changeset
|
3 |
x := 0;
|
Christian Urban <christian dot urban at kcl dot ac dot uk>
diff
changeset
|
4 |
y := 1;
|
80
Christian Urban <christian dot urban at kcl dot ac dot uk>
diff
changeset
|
5 |
while n > 0 do {
|
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
diff
changeset
|
6 |
temp := y;
|
Christian Urban <christian dot urban at kcl dot ac dot uk>
diff
changeset
|
7 |
y := x + y;
|
Christian Urban <christian dot urban at kcl dot ac dot uk>
diff
changeset
|
8 |
x := temp;
|
Christian Urban <christian dot urban at kcl dot ac dot uk>
diff
changeset
|
9 |
n := n - 1
|
75
Christian Urban <christian dot urban at kcl dot ac dot uk>
diff
changeset
|
10 |
};
|
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
diff
changeset
|
11 |
write "Result ";
|
Christian Urban <christian dot urban at kcl dot ac dot uk>
diff
changeset
|
12 |
write y
|
75
Christian Urban <christian dot urban at kcl dot ac dot uk>
diff
changeset
|
13 |
|