Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _06._High_Jump
- {
- class Program
- {
- static void Main(string[] args)
- {
- int desiredHeight = int.Parse(Console.ReadLine());
- int totalJumps = 0;
- int failedJumps = 0;
- int currentHeight = desiredHeight - 30;
- while (currentHeight <= desiredHeight)
- {
- for (int i = 0; i < 3; i++)
- {
- int jumpHeight = int.Parse(Console.ReadLine());
- totalJumps++;
- if (jumpHeight > currentHeight)
- {
- currentHeight += 5;
- break;
- }
- if (i == 2)
- {
- Console.WriteLine($"Tihomir failed at {currentHeight}cm after {totalJumps} jumps.");
- return;
- }
- }
- }
- Console.WriteLine($"Tihomir succeeded, he jumped over {desiredHeight}cm after {totalJumps} jumps.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement