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