Advertisement
GL1TCH3D

Batch test threes and fives

Jun 20th, 2015
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. @echo off
  2. Setlocal enabledelayedexpansion
  3.  
  4. :top1
  5.  
  6. Echo Set the limit to the array (1 - X)
  7. Set /P end=X=
  8.  
  9. If not X GTR 0 call dumbass
  10.  
  11. Set /a test3=(%end%/3)+1
  12. Set /a test5=(%end%/5)+1
  13.  
  14. For /L %%A in (1,1,%end%) do set number%%A=%%A
  15.  
  16. For /L %%B in (1,1,%test3%) do (
  17. Set /a current=%%B*3
  18. Set number!current!=Fizz
  19. )
  20.  
  21. For /L %%C in (1,1,%test5%) do (
  22. Set /a current=%%C*5
  23. Set number!current!=Buzz
  24. )
  25.  
  26. For /L %%D in (1,1,%end%) do (
  27. Echo !number%%D!
  28. )
  29.  
  30. Echo End of Array.
  31. Pause>nul
  32.  
  33.  
  34.  
  35. :dumbass
  36.  
  37. Echo You didn't input a valid number. Try again.
  38.  
  39. Pause
  40.  
  41. Cls
  42.  
  43. Goto top1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement