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 total = 0;
- while (total < 10000)
- {
- string steps = Console.ReadLine();
- if (steps == "Going home")
- {
- total += int.Parse(Console.ReadLine());
- break;
- }
- int step = int.Parse(steps);
- total += step;
- }
- if (total < 10000)
- {
- Console.WriteLine($"{10000 - total} more steps to reach goal.");
- }
- else
- {
- Console.WriteLine("Goal reached! Good job!");
- Console.WriteLine($"{total - 10000} steps over the goal!");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment