Stan0033

Untitled

Apr 6th, 2021
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. using System;
  2.  
  3. namespace steps
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int steps_goal = 10_000;
  10. int steps = 0;
  11. int steps_left = 0;
  12. int steps_over = 0;
  13.  
  14.  
  15. string input = string.Empty;
  16. int Steps_To_Home = 0;
  17.  
  18. while (steps < 10_000)
  19. {
  20. input = Console.ReadLine();
  21.  
  22. //-----------------------------------------
  23. //-----------------------------------------
  24.  
  25. if (input == "Going Home")
  26. {
  27.  
  28. input = Console.ReadLine();
  29. Steps_To_Home += int.Parse(input);
  30. break;
  31. }
  32. else { steps += int.Parse(input); }
  33. //-----------------------------------------
  34. //-----------------------------------------
  35.  
  36.  
  37.  
  38.  
  39. //-----------------------------------------
  40. //-----------------------------------------
  41.  
  42.  
  43.  
  44. }
  45.  
  46.  
  47. if (steps >= steps_goal)
  48. {
  49. steps_over = steps - steps_goal; Console.WriteLine($"Goal reached! Good job!\n{steps_over} steps over the goal!");
  50.  
  51. }
  52. if (steps < steps_goal)
  53. {
  54. steps_left = steps_goal - steps;
  55. if (steps_left > 0) { Console.WriteLine($"{steps_left} to reach goal"); }
  56. }
  57.  
  58.  
  59. //-----------------------------------------
  60. //-----------------------------------------
  61. }
  62. }
  63. }
  64.  
Advertisement
Add Comment
Please, Sign In to add comment