Advertisement
FaresX

Untitled

Dec 22nd, 2016
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. class Program
  5. {
  6.     static void Main(string[] args)
  7.     {
  8.         float money = float.Parse(Console.ReadLine());
  9.         float floorWidth = float.Parse(Console.ReadLine());
  10.         float floorLength = float.Parse(Console.ReadLine());
  11.         float triangleSide = float.Parse(Console.ReadLine());
  12.         float triangleHeigh = float.Parse(Console.ReadLine());
  13.         float pricePerTile = float.Parse(Console.ReadLine());
  14.         float expenses = float.Parse(Console.ReadLine());
  15.         double floorArea = floorWidth * floorLength;
  16.         double tileArea = triangleSide * triangleHeigh / 2;
  17.         double numOfTiles = Math.Ceiling(floorArea / tileArea) + 5;
  18.         double totalSum = numOfTiles * pricePerTile + expenses;
  19.         double res = Math.Abs(money - totalSum);
  20.         if (money >= totalSum) Console.WriteLine("{0} lv left.", res.ToString("F"));
  21.         else if (money < totalSum) Console.WriteLine("You'll need {0} lv more.", res.ToString("F"));  
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement