Advertisement
IordanRujinov

Shopping

Mar 12th, 2018
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 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 Shopping
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double Budget = double.Parse(Console.ReadLine());
  14.             double chocolate = double.Parse(Console.ReadLine());
  15.             double Milk = double.Parse(Console.ReadLine());
  16.  
  17.             double mandarins = Math.Truncate(chocolate - (chocolate * 0.35));
  18.             mandarins *= 0.20;
  19.             chocolate *= 0.65;
  20.             Milk *= 2.70;
  21.             double sum = 0.00;
  22.             sum = mandarins + chocolate + Milk;
  23.  
  24.             bool check = Budget >= sum;
  25.  
  26.             if (check)
  27.             {
  28.                 Budget -= sum;
  29.                 Console.WriteLine("You got this, {0:F2} money left!", Budget);
  30.             }
  31.             else
  32.             {
  33.                 sum -= Budget;
  34.                 Console.WriteLine("Not enough money, you need {0:F2} more!", sum);
  35.             }
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement