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 _15_exam3_SmartLily
- {
- class Program
- {
- static void Main(string[] args)
- {
- double age = double.Parse(Console.ReadLine());
- double laundryPrice = double.Parse(Console.ReadLine());
- double gamePrice = double.Parse(Console.ReadLine());
- double money = 0.0;
- for (int i = 1; i <= age; i++)
- {
- if (i % 2 == 0)
- {
- money += ((i / 2.0) * 10 - 1);
- }
- else
- {
- money += gamePrice;
- }
- }
- double diff = Math.Abs(money - laundryPrice);
- if (money >= laundryPrice)
- {
- Console.WriteLine($"Yes! {diff:f2}");
- }
- else
- {
- Console.WriteLine($"No! {diff:f2}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment