Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace excercise
- {
- class Program
- {
- static void Main(string[] args)
- {
- double budget = double.Parse(Console.ReadLine());
- int studentsNumber = int.Parse(Console.ReadLine());
- double priceLightSabers = double.Parse(Console.ReadLine());
- double priceRobes = double.Parse(Console.ReadLine());
- double priceBelts = double.Parse(Console.ReadLine());
- double additinalLightSabers =Math.Ceiling( 0.10*studentsNumber);
- double totalLightSabers = (studentsNumber+additinalLightSabers)* priceLightSabers;
- double totalRobes = priceRobes * studentsNumber;
- double freeBelts =Math.Floor(studentsNumber / 6.00);
- double totalBelts = priceBelts *( studentsNumber-freeBelts);
- double moneyNeeded = totalBelts + totalLightSabers + totalRobes;
- if (budget>=moneyNeeded)
- {
- Console.WriteLine($"The money is enough - it would cost {moneyNeeded:f2}lv.");
- }
- else
- {
- double moneyDiff = moneyNeeded - budget;
- Console.WriteLine($"Ivan Cho will need {moneyDiff:f2}lv more.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement