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