Advertisement
Alexander_B

Walking

Feb 9th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace DomashnoWalking
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int steps = 0;
  14. int goalSteps = 10000;
  15.  
  16.  
  17. while (true)
  18. {
  19. string command = Console.ReadLine().ToLower();
  20. if (command == "going home")
  21. {
  22. int stepsToHome = int.Parse(Console.ReadLine());
  23. int stepsRemaining = goalSteps - steps - stepsToHome;
  24.  
  25. if (stepsRemaining > 0)
  26. {
  27. Console.WriteLine($"{stepsRemaining} more steps to reach goal.");
  28. break;
  29. }
  30. else
  31. {
  32. Console.WriteLine("Goal reached! Good job!");
  33. break;
  34. }
  35. break;
  36. }
  37.  
  38. int number = int.Parse(command);
  39. steps += number;
  40.  
  41. if (steps >= goalSteps)
  42. {
  43. Console.WriteLine("Goal reached! Good job!");
  44. break;
  45. }
  46. }
  47.  
  48.  
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement