Advertisement
silvana1303

summer shopping

Mar 30th, 2020
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.08 KB | None | 0 0
  1. using System;
  2.  
  3. namespace morexercies
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int budget = int.Parse(Console.ReadLine());
  10.             double towelPrice = double.Parse(Console.ReadLine());
  11.             int discount = int.Parse(Console.ReadLine());
  12.  
  13.             var umbrellaPrice = towelPrice * 2/3;
  14.             var flipflopsPrice = umbrellaPrice * 0.75;
  15.             var beachBagPrice = (flipflopsPrice + towelPrice) / 3;
  16.  
  17.             var fullSum = towelPrice + umbrellaPrice + beachBagPrice + flipflopsPrice;
  18.  
  19.             var discountSum = fullSum - fullSum * discount / 100;
  20.             var moneyLeft = budget - discountSum;
  21.             var moneyNeeded = discountSum - budget;
  22.  
  23.             if (budget >= discountSum)
  24.             {
  25.                 Console.WriteLine($"Annie's sum is {discountSum:f2} lv. She has {moneyLeft:f2} lv. left.");
  26.             }
  27.             else
  28.             {
  29.                 Console.WriteLine($"Annie's sum is {discountSum:f2} lv. She needs {moneyNeeded:f2} lv. more.");
  30.             }
  31.  
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement