Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Bachelor_Party__Exam_24._11
- {
- class Program
- {
- static void Main(string[] args)
- {
- int priceForSinger = int.Parse(Console.ReadLine());
- string input = Console.ReadLine();
- int totalProfit = 0;
- int counterPeople = 0;
- while (input != "The restaurant is full")
- {
- int numOfPeople = int.Parse(input);
- counterPeople += numOfPeople;
- if (numOfPeople < 5)
- {
- totalProfit += numOfPeople * 100;
- }
- else if (numOfPeople >= 5)
- {
- totalProfit += numOfPeople * 70;
- }
- input = Console.ReadLine();
- }
- if (totalProfit >= priceForSinger)
- {
- Console.WriteLine($"You have {counterPeople} guests and {totalProfit - priceForSinger} leva left.");
- }
- else
- {
- Console.WriteLine($"You have {counterPeople} guests and {totalProfit} leva income, but no singer.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment