Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double stockMoney = double.Parse(Console.ReadLine());
- int studentsCnt = int.Parse(Console.ReadLine());
- double lightsaberPrice = double.Parse(Console.ReadLine());
- double robePrice = double.Parse(Console.ReadLine());
- double beltPrice = double.Parse(Console.ReadLine());
- double percent10lightsabersStudents = Math.Ceiling(studentsCnt * 0.1);
- double lightsabers = (studentsCnt + percent10lightsabersStudents) * lightsaberPrice;
- double robes = studentsCnt * robePrice;
- double sixthBelts = Math.Floor((double)studentsCnt / 6);
- double belts = (studentsCnt * beltPrice) - (sixthBelts * beltPrice);
- double sum = lightsabers + robes + belts;
- if (stockMoney >= sum)
- {
- Console.WriteLine($"The money is enough - it would cost {sum:f2}lv.");
- }
- else
- {
- Console.WriteLine($"John will need {sum - stockMoney:f2}lv more.");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement