Advertisement
ss3434

Untitled

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