Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace steps
- {
- class Program
- {
- static void Main(string[] args)
- {
- int steps_goal = 10_000;
- int steps = 0;
- int steps_left = 0;
- int steps_over = 0;
- string input = string.Empty;
- int Steps_To_Home = 0;
- while (steps < 10_000)
- {
- input = Console.ReadLine();
- //-----------------------------------------
- //-----------------------------------------
- if (input == "Going Home")
- {
- input = Console.ReadLine();
- Steps_To_Home += int.Parse(input);
- break;
- }
- else { steps += int.Parse(input); }
- //-----------------------------------------
- //-----------------------------------------
- //-----------------------------------------
- //-----------------------------------------
- }
- if (steps >= steps_goal)
- {
- steps_over = steps - steps_goal; Console.WriteLine($"Goal reached! Good job!\n{steps_over} steps over the goal!");
- }
- if (steps < steps_goal)
- {
- steps_left = steps_goal - steps;
- if (steps_left > 0) { Console.WriteLine($"{steps_left} to reach goal"); }
- }
- //-----------------------------------------
- //-----------------------------------------
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment