Advertisement
Guest User

Untitled

a guest
Mar 11th, 2018
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.11 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _02.Умната_Лили
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var age = int.Parse(Console.ReadLine());
  14.             var washingPrice = double.Parse(Console.ReadLine());
  15.             var toyPrice = double.Parse(Console.ReadLine());
  16.             double  moneyForBD = 10.0;
  17.             double  toyCount = 0.0;
  18.             double  savedMoney = 0.0;
  19.             double  totalMoney = 0.0;
  20.  
  21.             for (int currAge = 1; currAge < age; currAge++)
  22.             {
  23.                 if (currAge % 2 == 0)
  24.                 {
  25.                     savedMoney += moneyForBD - 1;
  26.                     moneyForBD += 10;
  27.                 }
  28.                 else toyCount++;
  29.             }
  30.  
  31.             totalMoney = savedMoney + (toyPrice * toyCount);
  32.  
  33.             if (totalMoney >= washingPrice) Console.WriteLine("Yes!{0:f2}", totalMoney - washingPrice);
  34.             else Console.WriteLine("No!{0:f2}", washingPrice - totalMoney);
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement