fork download
  1. @echo off
  2. setlocal enabledelayedexpansion
  3.  
  4. :: Get user input for pesos
  5. set /p pesos=Enter the number of pesos:
  6.  
  7. :: Calculate base time in minutes
  8. set /a time=%pesos% * 5
  9.  
  10. :: Add additional time based on the peso range
  11. if %pesos% geq 20 if %pesos% lss 30 set /a time+=5
  12. if %pesos% geq 30 if %pesos% lss 40 set /a time+=10
  13. if %pesos% geq 50 set /a time+=15
  14.  
  15. :: Convert time to hours, minutes, and seconds
  16. set /a hours=%time% / 60
  17. set /a minutes=%time% %% 60
  18. set /a seconds=0
  19.  
  20. :: Display the countdown
  21. :countdown
  22. cls
  23. :: Display countdown in hours, minutes, seconds
  24. echo Time remaining: !hours! hours !minutes! minutes !seconds! seconds
  25. set /a seconds-=1
  26.  
  27. :: Adjust seconds and minutes if necessary
  28. if !seconds! lss 0 (
  29. set /a seconds=59
  30. set /a minutes-=1
  31. )
  32.  
  33. if !minutes! lss 0 (
  34. set /a minutes=59
  35. set /a hours-=1
  36. )
  37.  
  38. if !hours! lss 0 (
  39. goto hibernate
  40. )
  41.  
  42. :: Wait for 1 second and repeat
  43. timeout /nobreak /t 1 >nul
  44. goto countdown
  45.  
  46. :hibernate
  47. cls
  48. echo Countdown finished. The system will hibernate now.
  49. shutdown /h
  50.  
Success #stdin #stdout #stderr 0s 5284KB
stdin
Standard input is empty
stdout
0
0
stderr
prog.bc 1: illegal character: @
prog.bc 1: syntax error
prog.bc 2: syntax error
prog.bc 4: illegal character: :
prog.bc 4: illegal character: :
prog.bc 4: syntax error
prog.bc 5: syntax error
prog.bc 5: syntax error
prog.bc 5: illegal character: :
prog.bc 7: illegal character: :
prog.bc 7: illegal character: :
prog.bc 7: syntax error
prog.bc 8: syntax error
prog.bc 10: illegal character: :
prog.bc 10: illegal character: :
prog.bc 10: syntax error
prog.bc 11: syntax error
prog.bc 11: syntax error
prog.bc 11: syntax error
prog.bc 11: syntax error
prog.bc 12: syntax error
prog.bc 12: syntax error
prog.bc 12: syntax error
prog.bc 12: syntax error
prog.bc 13: syntax error
prog.bc 13: syntax error
prog.bc 13: syntax error
prog.bc 15: illegal character: :
prog.bc 15: illegal character: :
prog.bc 15: syntax error
prog.bc 16: syntax error
prog.bc 17: syntax error
prog.bc 18: syntax error
prog.bc 20: illegal character: :
prog.bc 20: illegal character: :
prog.bc 20: syntax error
prog.bc 21: illegal character: :
prog.bc 23: illegal character: :
prog.bc 23: illegal character: :
prog.bc 23: syntax error
prog.bc 24: syntax error
prog.bc 24: illegal character: :
prog.bc 25: syntax error
prog.bc 27: illegal character: :
prog.bc 27: illegal character: :
prog.bc 27: syntax error
prog.bc 28: syntax error
prog.bc 29: syntax error
prog.bc 30: syntax error
prog.bc 31: syntax error
prog.bc 33: syntax error
prog.bc 34: syntax error
prog.bc 35: syntax error
prog.bc 36: syntax error
prog.bc 38: syntax error
prog.bc 39: syntax error
prog.bc 42: illegal character: :
prog.bc 42: illegal character: :
prog.bc 42: syntax error
prog.bc 43: syntax error
prog.bc 44: syntax error
prog.bc 46: illegal character: :
prog.bc 48: syntax error
Runtime error (func=(main), adr=5): Divide by zero