Advertisement
ss3434

Untitled

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