Advertisement
Guest User

Untitled

a guest
Feb 8th, 2020
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp1
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9.  
  10. int sum = 0;
  11. bool b = false;
  12. while(sum <= 10000)
  13. {
  14. string steps = Console.ReadLine();
  15. if(steps == "Going home")
  16. {
  17. sum += int.Parse(Console.ReadLine());
  18. if(sum >= 10000)
  19. {
  20. Console.WriteLine("Goal reached! Good job!");
  21. }
  22. else
  23. {
  24. Console.WriteLine($"{(10000 - sum)} more steps to reach goal.");
  25. }
  26.  
  27.  
  28. b = true;break;
  29. }
  30. else sum += int.Parse(steps);
  31. }
  32. if (b == false) Console.WriteLine("Goal reached! Good job!");
  33. }
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement