Advertisement
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 stapki
- {
- class Program
- {
- static void Main(string[] args)
- {
- int stepsGoal= 10000;
- int walkingSteps = int.Parse(Console.ReadLine());
- int stepsToHome = 0;
- while (walkingSteps < stepsGoal)
- {
- string comand = Console.ReadLine();
- if (comand=="Going home")
- {
- stepsToHome= int.Parse(Console.ReadLine());
- walkingSteps += stepsToHome;
- if(walkingSteps < stepsGoal )
- {
- double a = stepsGoal - walkingSteps;
- Console.WriteLine($"{a} more steps to reach goal.");
- return;
- }
- else
- {
- Console.WriteLine("Goal reached! Good job!");
- return;
- }
- }
- walkingSteps += int.Parse(comand);
- }
- Console.WriteLine("Goal reached! Good job!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement