aboutsummaryrefslogtreecommitdiff
path: root/fibo.lang
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-09-02 15:48:01 +0200
committertomsmeding <tom.smeding@gmail.com>2017-09-02 15:51:08 +0200
commitc3c19f3220485af12c3a5561ad1754bf546e7429 (patch)
tree80e601853f7259722c4ec8fa3dc2704cd3f125f9 /fibo.lang
parent45e9991a1f83974c3459037f4791d865f5b342f1 (diff)
Move *.lang files to a directory
Diffstat (limited to 'fibo.lang')
-rw-r--r--fibo.lang31
1 files changed, 0 insertions, 31 deletions
diff --git a/fibo.lang b/fibo.lang
deleted file mode 100644
index e1a7a4a..0000000
--- a/fibo.lang
+++ /dev/null
@@ -1,31 +0,0 @@
-func printnum(int n) {
- if (n == 0) {putc('0'); return;}
- if (n < 0) {putc('-'); n = -n;}
- while (n > 0) {
- putc('0' + char(n % 10));
- n = n / 10;
- }
-}
-
-func int fibo(int n) {
- int a := 0;
- int b := 1;
- int i := 0;
- while (i < n) {
- int c := a + b;
- a = b;
- b = c;
- i = i + 1;
- }
- return b;
-}
-
-func int main() {
- int i := 0;
- while (i <= 20) {
- printnum(fibo(i));
- putc('\n');
- i = i + 1;
- }
- return 0;
-}