Advertisement
Guest User

FibonacciSeq

a guest
Jun 21st, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.52 KB | None | 0 0
  1. @echo off
  2. :: Give it a tasteful look...
  3. color 0a
  4. :: Initial echos and setting of c value
  5. echo 1 1 1 1 1 1
  6. echo 1 1 1 1 1 1
  7. set /a a=1
  8. set /a b=1
  9. set /a c=%a%+%b%
  10. :: Time to loop, begin by echoing c then shifting all the values down
  11. :loop
  12. echo %c% %c% %c% %c% %c% %c%
  13. set /a a=%b%
  14. set /a b=%c%
  15. set /a c=%a%+%b%
  16. :: Check if c has overflowed the integer, reset to 1
  17. if %c% LSS 0 goto reset
  18. goto loop
  19. pause
  20. :: Actual code for resetting values
  21. :reset
  22. set /a a=1
  23. set /a b=1
  24. set /a c=1
  25. echo 1 1 1 1 1 1
  26. goto loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement