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