Advertisement
Spocoman

09. Padawan Equipment

Jan 12th, 2022
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.03 KB | None | 0 0
  1. using System;
  2.  
  3. namespace PadawanEquipment
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double money = double.Parse(Console.ReadLine());
  10.             int count = int.Parse(Console.ReadLine());
  11.             double saber = double.Parse(Console.ReadLine());
  12.             double robe = double.Parse(Console.ReadLine());
  13.             double belt = double.Parse(Console.ReadLine());
  14.             double sum = 0;
  15.  
  16.             if (count < 6)
  17.             {
  18.                 sum = (Math.Ceiling(count * 1.1) * saber) + count * robe + count * belt;
  19.             }
  20.             else
  21.             {
  22.                 sum = (Math.Ceiling(count * 1.1) * saber) + count * robe + (count - count / 6) * belt;
  23.             }
  24.  
  25.             if (money >= sum)
  26.             {
  27.                 Console.WriteLine($"The money is enough - it would cost {sum:F2}lv.");
  28.             }
  29.             else
  30.             {
  31.                 Console.WriteLine($"John will need {sum - money:F2}lv more.");
  32.             }
  33.         }
  34.     }
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement