grach

2017_19_March_E_Styrofoam

Jul 21st, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.09 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 Styrofoam
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var budget = double.Parse(Console.ReadLine());
  14.             var areaHouse = double.Parse(Console.ReadLine());
  15.             var windows = double.Parse(Console.ReadLine());
  16.             var styroFoam = double.Parse(Console.ReadLine());
  17.             var pricePackd = double.Parse(Console.ReadLine());
  18.          
  19.             var areaToCover = (areaHouse - windows * 2.4)*1.1;
  20.             var neededPacked = Math.Ceiling(areaToCover / styroFoam);
  21.             var price = neededPacked * pricePackd;
  22.                      
  23.  
  24.             if (price<=budget)
  25.             {            
  26.                 Console.WriteLine("Spent: {0:f2}", price);
  27.                 Console.WriteLine("Left: {0:f2}", budget -price);
  28.             }
  29.                
  30.          else
  31.             {
  32.                 Console.WriteLine("Need more: {0:f2}", price-budget);
  33.             }      
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment