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.Tasks;
- namespace SmartLilly
- {
- class Program
- {
- static void Main(string[] args)
- {
- int LiliAge = int.Parse(Console.ReadLine());
- double washingMashinePrice = double.Parse(Console.ReadLine());
- int priceOfToys = int.Parse(Console.ReadLine());
- var moneyForBirhday = 10.0;
- var savedMoney = 0.0;
- var numberOfToys = 0.0;
- var moneyForToys = 0.0;
- var totalMoney = 0.0;
- for (int i = 1; i <= LiliAge ; i++)
- {
- if (i % 2 ==0)
- {
- savedMoney += (moneyForBirhday - 1);
- moneyForBirhday += 10;
- }
- else
- {
- numberOfToys = numberOfToys + 1;
- moneyForToys = numberOfToys * priceOfToys;
- }
- totalMoney = savedMoney + moneyForToys;
- }
- if (totalMoney > washingMashinePrice)
- {
- Console.WriteLine("Yes! " + "{0:f2}", totalMoney - washingMashinePrice);
- }
- else
- {
- Console.WriteLine("No! " + "{0:f2}", washingMashinePrice - totalMoney);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment