Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Товарен_багаж
- {
- class Program
- {
- static void Main(string[] args)
- {
- double capacity = double.Parse(Console.ReadLine());
- double countLuggage = 0;
- double allSpace = 0;
- while (capacity > 0)
- {
- string command = Console.ReadLine();
- if (command == "End")
- {
- Console.WriteLine("Congratulations! All suitcases are loaded!");
- break;
- }
- double volumeSuitCase = double.Parse(command);
- countLuggage++;
- allSpace += volumeSuitCase;
- if (capacity < allSpace)
- {
- Console.WriteLine("No more space!");
- countLuggage--;
- break;
- }
- }
- Console.WriteLine($"Statistic: {countLuggage} suitcases loaded."
- );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment