Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _06.High_Jump
- {
- class Program
- {
- static void Main(string[] args)
- {
- int wantHigh = int.Parse(Console.ReadLine());
- int start = wantHigh - 30;
- int jumpCounter = 0;
- int attempts = 0;
- for (int i = 0; i <=3; i++)
- {
- attempts = int.Parse(Console.ReadLine());
- jumpCounter++;
- if (attempts > start)
- {
- i--;
- start += 5;
- }
- if (attempts>=wantHigh)
- {
- Console.WriteLine($"Tihomir succeeded, he jumped over {wantHigh}cm after { jumpCounter} jumps.");
- break;
- }
- if (i==3)
- {
- jumpCounter++;
- Console.WriteLine($"Tihomir failed at {attempts}cm after {jumpCounter} jumps.");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement