Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Walking
- {
- class Program
- {
- static void Main(string[] args)
- {
- int MaxSteps = 10000;
- int TotalSteps = 0;
- while(TotalSteps < MaxSteps)
- {
- string Steps = Console.ReadLine();
- if (Steps!= "Going home")
- {
- TotalSteps += int.Parse(Steps);
- }
- else if (Steps == "Going home")
- {
- TotalSteps += int.Parse(Console.ReadLine());
- break;
- }
- }
- if(TotalSteps >= MaxSteps)
- {
- Console.WriteLine("Goal reached! Good job!");
- }
- else
- {
- Console.WriteLine($"{MaxSteps-TotalSteps} more steps to reach goal.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment