summaryrefslogtreecommitdiff
path: root/nl/fibo.nl
blob: ac12c2de10c386b60ef9b60e29c6491d25199644 (plain)
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
type int = i32;
type char = i8;

extern func void(int) putchar;

void printnum(int n){
	if(n==0){
		putchar('0');
		putchar('\n');
		return;
	}
	if(n<0){
		putchar('-');
		n=-n;
	}
	while(n>0){
		putchar('0'+n%10);
		n=n/10;
	}
	putchar('\n');
	return;
}

int main(){
	int a=0;
	int b=1;
	int i=0;
	while(i<=10){
		printnum(b);
		b=a+b;
		a=b-a;
		i=i+1;
	}
	return 0;
}