Advertisement
Spocoman

Summer Shopping

Oct 7th, 2023 (edited)
632
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. using System;
  2.  
  3. namespace SummerShopping
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double budget = double.Parse(Console.ReadLine());
  10.             double towel = double.Parse(Console.ReadLine());
  11.             int discount = int.Parse(Console.ReadLine());
  12.  
  13.             double umbrella = towel / 3 * 2;
  14.             double flipFlops = umbrella * 0.75;
  15.             double beachBag = (towel + flipFlops) / 3;
  16.  
  17.             double sum = (towel + umbrella + flipFlops + beachBag) * (100 - discount) / 100;
  18.  
  19.             Console.Write($"Annie's sum is {sum:f2} lv. ");
  20.             if (budget >= sum)
  21.             {
  22.                 Console.WriteLine($"She has {budget - sum:f2} lv. left.");
  23.             }
  24.             else
  25.             {
  26.                 Console.WriteLine($"She needs {sum - budget:f2} lv. more.");
  27.             }
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement