knikolov98

Untitled

Sep 11th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.08 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Petq_magazin_za_igrachki
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double vac = double.Parse(Console.ReadLine());
  10.  
  11.             int puzzleQ = int.Parse(Console.ReadLine());
  12.             int dollQ = int.Parse(Console.ReadLine());
  13.             int bearQ = int.Parse(Console.ReadLine());
  14.             int minionQ = int.Parse(Console.ReadLine());
  15.             int truckQ = int.Parse(Console.ReadLine());
  16.  
  17.             double totalQ = puzzleQ + dollQ + bearQ + minionQ + truckQ;
  18.             double total = (puzzleQ * 2.6) + (dollQ * 3) + (bearQ * 4.1) + (minionQ * 8.2) + (truckQ * 2);
  19.  
  20.             if ( totalQ >= 50)
  21.             {
  22.                 total = total * (1 - 0.25);
  23.             }
  24.  
  25.             total *= (1 - 0.1);
  26.  
  27.             if (total >= vac)
  28.  
  29.             {
  30.                 Console.WriteLine($"Yes! {total - vac:f2} lv left.");
  31.             }
  32.  
  33.             else
  34.             {
  35.                 Console.WriteLine($"Not enough money! {vac - total:F2} lv needed.");
  36.             }
  37.  
  38.         }
  39.     }
  40. }
Add Comment
Please, Sign In to add comment