Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Concatenate_data
- {
- class Program
- {
- static void Main(string[] args)
- {
- int targetPrice = int.Parse(Console.ReadLine());
- double sum = 0;
- double totalSum = 0;
- while (true)
- {
- string nameOfTheCocktail = Console.ReadLine();
- if (nameOfTheCocktail == "Party!")
- {
- Console.WriteLine($"We need {targetPrice - totalSum:f2} leva more.");
- break;
- }
- int price = int.Parse(Console.ReadLine());
- double nameLength = nameOfTheCocktail.Length;
- sum = nameLength * price;
- totalSum += sum;
- if (sum % 2 != 0)
- {
- totalSum = totalSum - (totalSum * 0.25);
- }
- if (totalSum > targetPrice)
- {
- Console.WriteLine("Target acquired.");
- break;
- }
- }
- Console.WriteLine($"Club income - {totalSum:f2} leva.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement