Advertisement
DidiMilikina

02.Flower shop

Apr 4th, 2017
69
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 _02.Flower_Shop
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var numberOfMagnolias = int.Parse(Console.ReadLine());
  14.             var numberOfHyacinths = int.Parse(Console.ReadLine());
  15.             var numberOfRoses = int.Parse(Console.ReadLine());
  16.             var numberOfCactus = int.Parse(Console.ReadLine());
  17.             var priceForPresent = double.Parse(Console.ReadLine());
  18.  
  19.             var price = numberOfMagnolias * 3.35 + numberOfHyacinths * 4.0 + numberOfRoses * 3.5 + numberOfCactus * 8.0;
  20.             var money = price - (price * 0.05);
  21.  
  22.             if (price <= money)
  23.             {
  24.                 Console.WriteLine("She is left with {0} leva.", Math.Floor(money - price));
  25.             }
  26.             else
  27.             {
  28.                 Console.WriteLine("She will have to borrow {0} leva.", Math.Ceiling(price - money));
  29.             }
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement