Advertisement
Guest User

Untitled

a guest
Feb 8th, 2020
600
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp1
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int steps = 10000;
  10. int dailysteps = 0;
  11. int sumsteps = 0;
  12. string command = Console.ReadLine();
  13. while(command != "Going home")
  14. {
  15. dailysteps = int.Parse(command);
  16. sumsteps += dailysteps;
  17. if(sumsteps >= steps)
  18. {
  19. Console.WriteLine("Goal reached! Good job!"); break;
  20. }
  21. command = Console.ReadLine();
  22. }
  23. if(command == "Going home")
  24. {
  25. dailysteps = int.Parse(Console.ReadLine());
  26. sumsteps += dailysteps;
  27. if (sumsteps >= steps) Console.WriteLine("Goal reached! Good job!");
  28. else if (sumsteps < steps) Console.WriteLine($"{(steps - sumsteps)} more steps to reach goal.");
  29. }
  30.  
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement