Advertisement
Yancho_code

Untitled

Apr 19th, 2019
554
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _06.High_Jump
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int wantHigh = int.Parse(Console.ReadLine());
  14. int start = wantHigh - 30;
  15. int jumpCounter = 0;
  16. int attempts = 0;
  17. for (int i = 0; i <=3; i++)
  18. {
  19. attempts = int.Parse(Console.ReadLine());
  20. jumpCounter++;
  21. if (attempts > start)
  22. {
  23. i--;
  24. start += 5;
  25. }
  26.  
  27. if (attempts>=wantHigh)
  28. {
  29. Console.WriteLine($"Tihomir succeeded, he jumped over {wantHigh}cm after { jumpCounter} jumps.");
  30. break;
  31. }
  32. if (i==3)
  33. {
  34. jumpCounter++;
  35. Console.WriteLine($"Tihomir failed at {attempts}cm after {jumpCounter} jumps.");
  36. }
  37. }
  38.  
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement