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 age = int.Parse(Console.ReadLine());
- double priceWashing = double.Parse(Console.ReadLine());
- int priceToy = int.Parse(Console.ReadLine());
- double money = 0;
- int toys = 0;
- double sum = 0;
- for (int i = 1; i <= age; i++)
- {
- if (i % 2 == 0)
- {
- money += 5 * i - 1;
- }
- else
- {
- toys++;
- }
- }
- sum = toys * priceToy + money;
- if (priceWashing > sum)
- {
- Console.WriteLine($"No! {priceWashing- sum:F2}");
- }
- else
- {
- Console.WriteLine($"Yes! {sum - priceWashing:F2}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement