Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- title Icarus Challenge 3 - Fibonacci Sequence
- setlocal enabledelayedexpansion
- :top
- set/p steps=How many steps of the fibonacci sequence would you like to calculate?
- set steps=!steps: =!
- if not 0 lss %steps% cls&goto top
- set step0=0
- set step1=1
- set num=2
- set all=0
- :loop
- if %num% equ %steps% goto end
- set /a temp1=%num% - 1
- set /a temp2=%num% - 2
- set /a step%num%= !step%temp1%! + !step%temp2%!
- echo !step%temp2%! + !step%temp1%! = !step%num%!
- set /a num+=1
- goto loop
- :end
- for /l %%b in (1,1,%num%) do (
- set all=!all!, !step%%b!
- )
- echo.
- echo The numbers in a list:
- echo %all%
- pause > nul
Advertisement
Add Comment
Please, Sign In to add comment