Advertisement
SavaIv

Untitled

Jan 15th, 2020
690
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _06._High_Jump
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double hightTarget = double.Parse(Console.ReadLine());
  10.  
  11. double hightActual = Math.Abs(hightTarget) - 30;
  12.  
  13. int jumpCounterTotal = 0;
  14. int jumpCounterFail = 0;
  15.  
  16. while (true)
  17. {
  18.  
  19. int hightJump = int.Parse(Console.ReadLine());
  20. jumpCounterTotal++;
  21.  
  22. if (hightJump > hightActual)
  23. {
  24. jumpCounterFail = 0;
  25.  
  26. if (hightJump > hightTarget)
  27. {
  28. Console.WriteLine("Tihomir succeeded, he jumped over {0}cm after {1} jumps.", hightTarget, jumpCounterTotal);
  29. break;
  30. }
  31. else
  32. {
  33. hightActual += 5;
  34. continue;
  35. }
  36.  
  37. }
  38. else
  39. {
  40. jumpCounterFail++;
  41.  
  42. if(jumpCounterFail == 3)
  43. {
  44. Console.WriteLine("Tihomir failed at {0}cm after {1} jumps.", hightActual, jumpCounterTotal);
  45. break;
  46. }
  47. }
  48. }
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement