Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Clever_Lily
- {
- class Program
- {
- static void Main(string[] args)
- {
- int ageOfLilly = int.Parse(Console.ReadLine());
- double priceOfLaundryM = double.Parse(Console.ReadLine());
- int priceToy = int.Parse(Console.ReadLine());
- int toys = 0;
- int money = 0;
- int totalMoney = 0;
- for (int iterator = 1; iterator <= ageOfLilly; iterator++)
- {
- money += 5;
- if (iterator % 2 == 0)
- {
- totalMoney += money - 1;
- }
- else
- {
- toys++;
- }
- }
- totalMoney += toys * priceToy;
- if (totalMoney >= priceOfLaundryM)
- {
- Console.WriteLine($"Yes! {totalMoney - priceOfLaundryM:F2}");
- }
- else
- {
- Console.WriteLine($"No! {priceOfLaundryM - totalMoney:F2}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement