Advertisement
Guest User

Untitled

a guest
Nov 26th, 2019
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _02._Summer_Shopping
  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. double umbrella = 2 * towelPrice / 3;
  14. double slippers = umbrella * 0.75;
  15. double beachBag = 1 * (towelPrice + slippers) / 3;
  16.  
  17. double totalSum = towelPrice + umbrella + slippers + beachBag;
  18. totalSum = totalSum - totalSum * 0.05;
  19.  
  20. if (budget >= totalSum)
  21. {
  22. Console.WriteLine($"Annie's sum is {totalSum:f2} lv. She has {Math.Abs(totalSum - budget):f2} lv. left.");
  23. }
  24. else
  25. {
  26. Console.WriteLine($"Annie's sum is {totalSum:f2} lv. She needs {budget - totalSum:f2)} lv. more.");
  27. }
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement