TTXScaryPro

Smart Lily

Oct 12th, 2017
439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.42 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 SmartLilly
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int LiliAge = int.Parse(Console.ReadLine());
  14.             double washingMashinePrice = double.Parse(Console.ReadLine());
  15.             int priceOfToys = int.Parse(Console.ReadLine());
  16.  
  17.             var moneyForBirhday = 10.0;
  18.             var savedMoney = 0.0;
  19.             var numberOfToys = 0.0;
  20.             var moneyForToys = 0.0;
  21.             var totalMoney = 0.0;
  22.  
  23.             for (int i = 1; i <= LiliAge ; i++)
  24.             {
  25.                 if (i % 2 ==0)
  26.                 {
  27.                     savedMoney += (moneyForBirhday - 1);
  28.                     moneyForBirhday += 10;
  29.                    
  30.                 }
  31.                 else
  32.                 {
  33.                     numberOfToys = numberOfToys + 1;
  34.                     moneyForToys = numberOfToys * priceOfToys;
  35.                 }
  36.  
  37.                 totalMoney = savedMoney + moneyForToys;
  38.             }
  39.             if (totalMoney > washingMashinePrice)
  40.             {
  41.                 Console.WriteLine("Yes! " + "{0:f2}", totalMoney - washingMashinePrice);
  42.             }
  43.             else
  44.             {
  45.                 Console.WriteLine("No! " + "{0:f2}", washingMashinePrice - totalMoney);
  46.             }
  47.         }
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment