Advertisement
Guest User

04.walking

a guest
May 20th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 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 uprajnenie
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int steps = 0;
  14. while (steps < 10000)
  15. {
  16. string command = Console.ReadLine();
  17.  
  18. if (command == "Going home")
  19. {
  20. steps += int.Parse(Console.ReadLine());
  21. if (steps >= 10000)
  22. {
  23. Console.WriteLine("Goal reached! Good job!");
  24. }
  25. else
  26. {
  27. int diff = 10000 - steps;
  28. Console.WriteLine($"{diff} more steps to reach goal.");
  29. }
  30. break;
  31. }
  32. else
  33. {
  34. steps += int.Parse(command);
  35. if (steps >= 10000)
  36. {
  37. Console.WriteLine("Goal reached! Good job!");
  38. }
  39. }
  40.  
  41. }
  42.  
  43.  
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement