Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CSLight
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int minutesPerPeople = 10;
- Console.WriteLine($"Время приема одного человека у врача равно {minutesPerPeople} минут");
- Console.Write("Введите кол-во людей в очереди: ");
- int amountPeople = Convert.ToInt32(Console.ReadLine());
- int minutesAll = minutesPerPeople * amountPeople;
- int hours = minutesAll / 60;
- int minutes = minutesAll % 60;
- string hoursString = hours.ToString();
- char penultimateChar = hoursString.Length >= 2 ? hoursString[hoursString.Length - 2] : '0';
- char lastChar = hoursString[hoursString.Length - 1];
- string hoursText = penultimateChar == '1' ? "часов" : lastChar == '1' ? "час" : lastChar == '2' || lastChar == '3' || lastChar == '4' ? "часа" : "часов";
- Console.WriteLine($"Время ожидания в очереди: {hours} {hoursText} и {minutes} минут");
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment