Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. using System;
  2.  
  3. public class Program
  4. {
  5. public static void Main()
  6. {
  7. double moneyTheyHave = double.Parse(Console.ReadLine());
  8. int studentsCount = int.Parse(Console.ReadLine());
  9. double priceOflightsabers = double.Parse(Console.ReadLine());
  10. double priceOfrobes = double.Parse(Console.ReadLine());
  11. double priceOfbelts = double.Parse(Console.ReadLine());
  12.  
  13. double totalPrice = 0;
  14. int freeBeltsCount = studentsCount/6;
  15.  
  16. totalPrice = Math.Ceiling(studentsCount * 1.1)* priceOflightsabers + studentsCount * priceOfrobes + (studentsCount - freeBeltsCount) * priceOfbelts;
  17.  
  18. if (moneyTheyHave >= totalPrice)
  19. {
  20. Console.WriteLine($"The money is enough - it would cost {totalPrice:F2}lv.");
  21. }
  22. else
  23. {
  24. Console.WriteLine($"Ivan Cho will need {totalPrice - moneyTheyHave:F2}lv more.");
  25. }
  26.  
  27.  
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement