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