Advertisement
MladenKarachanov

Toy Shop

May 25th, 2025
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1. int puzzles = int.Parse(Console.ReadLine());
  2. int doll = int.Parse(Console.ReadLine());        
  3. int bear  = int.Parse(Console.ReadLine());
  4. int minion = int.Parse(Console.ReadLine());
  5. int trycks = int.Parse(Console.ReadLine());
  6.  
  7. double priceToys = puzzles * 2.60 + doll * 3.0 + bear * 4.10 + minion * 8.20 + trycks * 2.0;
  8.  
  9. double sumToys = puzzles + doll + bear + minion + trycks;
  10.  
  11. if(sumToys >= 50)
  12. {
  13.    priceToys=priceToys- (priceToys *=0.25);
  14. }
  15. double rent = priceToys * 0.10;
  16. double result = priceToys - rent;
  17.  
  18. if (result >= holiday)
  19. {
  20.  
  21.     Console.WriteLine($"Yes! {result - holiday:f2} lv left.");
  22. }
  23. else
  24. {
  25.     Console.WriteLine($"Not enough money! {Math.Abs(result-holiday):f2} lv needed.");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement