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 TEST_Homework
- {
- class Program
- {
- static void Main(string[] args)
- {
- int total = 5364;
- string sleep = "";
- int days = 1;
- int meters = 0;
- while (true)
- {
- sleep = Console.ReadLine();
- if (sleep != "END")
- {
- if (sleep == "Yes")
- {
- ++days;
- }
- meters = int.Parse(Console.ReadLine());
- if (days > 5)
- {
- if (total >= 8848)
- {
- Console.WriteLine($"Goal reached for {days} days!");
- }
- else
- {
- Console.WriteLine("Failed!");
- Console.WriteLine($"{total}");
- }
- return;
- }
- total += meters;
- if (total >= 8848)
- {
- Console.WriteLine($"Goal reached for {days} days!");
- return;
- }
- }
- else
- {
- if (total >= 8848)
- {
- Console.WriteLine($"Goal reached for {days} days!");
- }
- else
- {
- Console.WriteLine("Failed!");
- Console.WriteLine($"{total}");
- }
- return;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment