Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- class CoffeeMachine
- {
- static void Main(string[] args)
- {
- Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
- int coinsWithAmoutOfFive = int.Parse(Console.ReadLine());
- int coinsWithAmoutOfTen = int.Parse(Console.ReadLine());
- int coinsWithAmoutOfTwelve = int.Parse(Console.ReadLine());
- int coinsWithAmoutOfFifty = int.Parse(Console.ReadLine());
- int coinsWithAmoutOfOne = int.Parse(Console.ReadLine());
- decimal amoutOfInputMoney = decimal.Parse(Console.ReadLine());
- decimal priceOfProduct = decimal.Parse(Console.ReadLine());
- decimal totalMoneyInMachine = (decimal)((coinsWithAmoutOfFive * 0.05) + (coinsWithAmoutOfTen * 0.10) + (coinsWithAmoutOfTwelve * 0.20) + (coinsWithAmoutOfFifty * 0.50) + coinsWithAmoutOfOne);
- if (amoutOfInputMoney - priceOfProduct < 0)
- {
- Console.WriteLine("More {0}", Math.Abs(Math.Round(amoutOfInputMoney - priceOfProduct, 2)));
- }
- else
- {
- if ((totalMoneyInMachine + priceOfProduct) >= amoutOfInputMoney)
- {
- Console.WriteLine("Yes {0}", Math.Round((totalMoneyInMachine + priceOfProduct) - amoutOfInputMoney, 2));
- }
- else
- {
- Console.WriteLine("No {0}", Math.Abs(Math.Round((totalMoneyInMachine + priceOfProduct) - amoutOfInputMoney, 2)));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment