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