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