Advertisement
Angel_Kalinkov

PB-2DRectangleArea-AngelKalinkov

Mar 17th, 2018
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.62 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _2DRectangleArea
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double y1 = double.Parse(Console.ReadLine());
  10.             double x2 = double.Parse(Console.ReadLine());
  11.             double y2 = double.Parse(Console.ReadLine());
  12.             double x1 = double.Parse(Console.ReadLine());
  13.  
  14.             double width = Math.Abs(x1 - x2);
  15.             double height = Math.Abs(y1 - y2);
  16.             double area = width * height;
  17.             double perimeter = (width + height) * 2;
  18.  
  19.             Console.WriteLine($"{area}\r\n{perimeter}");
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement