Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type
- row = file of integer;
- vector = array[1..100] of integer;
- var
- f: row;
- fibonacci: vector;
- n, size, i: integer;
- procedure fib(f:vector; n: integer);
- var
- fibonacci: vector;
- i,j: integer;
- begin
- fibonacci[1] := 1;
- fibonacci[2] := 1;
- i:=3;
- while fibonacci[i-1]+fibonacci[i-2] <= n do
- begin
- fibonacci[i] := fibonacci[i-1] + fibonacci[i-2];
- i:=i+1;
- end;
- i:=i-1;
- size:=i;
- f:=fibonacci;
- end;
- begin
- assign(f,'a.out');
- rewrite(f);
- readln(n);
- fib(fibonacci,n);
- for i:=1 to size do
- write(f,fibonacci[i]);
- close(f);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement