Advertisement
Daniel_007

04. Bachelor Party

Oct 26th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.17 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp3
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int priceForSinger = int.Parse(Console.ReadLine());
  10.             string guests = "";
  11.             int guestsNum = 0;
  12.             int counter = 0;
  13.             double money = 0;
  14.             while(true)
  15.             {
  16.                 guests = Console.ReadLine();
  17.                 if(guests == "The restaurant is full")
  18.                 {
  19.                     break;
  20.                 }
  21.                 guestsNum = int.Parse(guests);
  22.                 counter += guestsNum;
  23.                 if (guestsNum>=5)
  24.                 {
  25.                     money += guestsNum * 70;
  26.                 }
  27.                 else
  28.                 {
  29.                     money += guestsNum * 100;
  30.                 }
  31.             }
  32.             if (money >= priceForSinger)
  33.             {
  34.                 Console.WriteLine($"You have {counter} guests and {money-priceForSinger} leva left.");
  35.             }
  36.             else
  37.             {
  38.                 Console.WriteLine($"You have {counter} guests and {money} leva income, but no singer.");
  39.             }
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement