Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace morexercies
- {
- class Program
- {
- static void Main(string[] args)
- {
- int budget = int.Parse(Console.ReadLine());
- double towelPrice = double.Parse(Console.ReadLine());
- int discount = int.Parse(Console.ReadLine());
- var umbrellaPrice = towelPrice * 2/3;
- var flipflopsPrice = umbrellaPrice * 0.75;
- var beachBagPrice = (flipflopsPrice + towelPrice) / 3;
- var fullSum = towelPrice + umbrellaPrice + beachBagPrice + flipflopsPrice;
- var discountSum = fullSum - fullSum * discount / 100;
- var moneyLeft = budget - discountSum;
- var moneyNeeded = discountSum - budget;
- if (budget >= discountSum)
- {
- Console.WriteLine($"Annie's sum is {discountSum:f2} lv. She has {moneyLeft:f2} lv. left.");
- }
- else
- {
- Console.WriteLine($"Annie's sum is {discountSum:f2} lv. She needs {moneyNeeded:f2} lv. more.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement