home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1995 November
/
PCWK1195.iso
/
inne
/
podstawy
/
dos
/
4dos
/
4uzytki
/
jambtm02.exe
/
FIBONACC.BTM
< prev
next >
Wrap
Text File
|
1992-11-15
|
835b
|
27 lines
*REM This batch file is Freeware, free to use and redistribute unmodified *
*REM Jouni Miettunen * jon@stekt.oulu.fi * Oulu * Finland * Europe * 1992 *
REM This calculates the first 76 Fibonacci numbers F(n) = F(n-1) + F(n-2)
REM Timestamp 15-Nov-1992
break on^setlocal^unalias *^unset *
set a=0^set b=1
:loop
set c=%b^set b=%a^set a=%@eval[%b+%c]^set index=%@eval[%index+1]
REM just trying to create a decent output
screen %_row 0 Fibonacci(
screen %_row %@eval[12-%@len[%index]] %index):
screen %_row %@eval[36-%@len[%a]-%@int[%@eval[%@len[%a]/3]]]]
set plaza=%@eval[%@len[%a]%%3]
echos %@substr[%a,,%plaza]
for %q in (0 3 6 9 12) echos ` `%@substr[%a,%@eval[%plaza+%q],3]
echo.
REM Can't calculate beyond 76th Fibonacci number, see FIBOS255.BTM for more
if %index lt 76 goto loop
:end
break off^quit