Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Padawan_Equipment
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9.  
  10. float amounOfMoney = float.Parse(Console.ReadLine());
  11. int countOfStudents = int.Parse(Console.ReadLine());
  12. float priceOfLightsabers = float.Parse(Console.ReadLine());
  13. float priceOfRobes = float.Parse(Console.ReadLine());
  14. float priceOfLightBelts = float.Parse(Console.ReadLine());
  15.  
  16. int freeBelts = 0;
  17.  
  18. if (countOfStudents % 6 == 0)
  19. {
  20. freeBelts += 1;
  21. }
  22.  
  23. double neededMoney = priceOfLightsabers * (Math.Ceiling(countOfStudents * 1.1)) + priceOfRobes * countOfStudents + priceOfLightBelts * (countOfStudents - freeBelts);
  24.  
  25. if (neededMoney <= amounOfMoney)
  26. {
  27. Console.WriteLine($"The money is enough - it would cost {neededMoney:F2}lv.");
  28. }
  29. else if (neededMoney > amounOfMoney)
  30. {
  31. Console.WriteLine($"Ivan Cho will need {neededMoney - amounOfMoney:F2}lv more.");
  32. }
  33. }
  34.  
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement