Advertisement
alexbancheva

Krassi_Walking_Gabby

Feb 13th, 2020
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.29 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Krassi_Walking
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int steps = 0; // int.Parse(Console.ReadLine());
  10.          //   int counterSteps = steps;
  11.             string comand = Console.ReadLine();
  12.           //  int sumStep = 0;
  13.  
  14.             while (comand != "Going home")  // predi da sloja comand v skobite go napravih taka (steps <= 10000)
  15.             {
  16.                 steps += int.Parse(comand);                    //int.Parse(Console.ReadLine());
  17.                // counterSteps += steps;
  18.  
  19.                 if (steps >= 10000)
  20.                 {
  21.                     Console.WriteLine("Goal reached! Good job!");
  22.                     break;
  23.                 }
  24.  
  25.                 comand = Console.ReadLine();
  26.             }
  27.  
  28.             if (comand == "Going home")
  29.             {
  30.                 steps += int.Parse(Console.ReadLine());
  31.  
  32.                 if (steps >= 10000)
  33.                 {
  34.                     Console.WriteLine("Goal reached! Good job!");
  35.                    // break;
  36.                 }
  37.                 else
  38.                 {
  39.                     int diff = 10000 - steps;
  40.                     Console.WriteLine($"{diff} more steps to reach goal.");
  41.                 }
  42.             }
  43.  
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement