Advertisement
DragomiraV

Untitled

Jan 22nd, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp1
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double SumIvancho = double.Parse(Console.ReadLine());
  10. double studentsCount = int.Parse(Console.ReadLine());
  11. double sabresPriceOne = double.Parse(Console.ReadLine());
  12. double robesPriceOne = double.Parse(Console.ReadLine());
  13. double beltsPriceOne = double.Parse(Console.ReadLine());
  14.  
  15. double sabresMore = Math.Ceiling(studentsCount * 10/100);
  16. double priceSabres = sabresPriceOne * (studentsCount + sabresMore); ///
  17. double priceBelts = 0;
  18. double robesPrice = robesPriceOne * studentsCount;
  19.  
  20. if (studentsCount >= 6)
  21. {
  22. double priceOtstapkaForBelts = Math.Ceiling(studentsCount / 6); ////
  23. studentsCount -= priceOtstapkaForBelts;
  24. priceBelts = beltsPriceOne * studentsCount;
  25. }
  26. else
  27. {
  28. priceBelts = beltsPriceOne * studentsCount;
  29. }
  30.  
  31. double total = priceSabres + priceBelts + robesPrice;
  32.  
  33. double result = Math.Abs(total - SumIvancho);
  34.  
  35. if (SumIvancho >= result)
  36. {
  37. Console.WriteLine($"The money is enough - it would cost {total:f2}lv.");
  38. }
  39. else
  40. {
  41. Console.WriteLine($"Ivan Cho will need {result:f2}lv more.");
  42. }
  43.  
  44.  
  45.  
  46.  
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement