Advertisement
Daten

02. Picture in the Wall

Mar 12th, 2018
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.07 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 Picture_in_the_Wall
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var widthHole = double.Parse(Console.ReadLine());
  14.             var lengthHole = double.Parse(Console.ReadLine());
  15.             var pictureSide = double.Parse(Console.ReadLine());
  16.             var pictersCount = double.Parse(Console.ReadLine());
  17.  
  18.             double holeArea = widthHole * lengthHole;
  19.             double picturesArea = (pictureSide * pictureSide) * pictersCount;
  20.  
  21.             double difference = Math.Abs(holeArea - picturesArea);
  22.  
  23.             if (holeArea >= picturesArea)
  24.             {
  25.                 Console.WriteLine("The pictures fit in the hole. Hole area is {0} bigger than pictures area.", difference);
  26.             }
  27.             else
  28.             {
  29.                 Console.WriteLine("The pictures don't fit in the hole. Picture area is {0} bigger than hole area.", difference);
  30.             }
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement