nvnnaidenov

TwoDRectangleArea - Chapter 2.0

Feb 9th, 2022
528
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1. //Task 007, Chapter 2.0
  2. using System;
  3.  
  4. public class TwoDRectangleArea
  5. {
  6.     static void Main()
  7.     {
  8.         double x1 = double.Parse(Console.ReadLine());
  9.         double y1 = double.Parse(Console.ReadLine());
  10.         double x2 = double.Parse(Console.ReadLine());
  11.         double y2 = double.Parse(Console.ReadLine());
  12.  
  13.         double width = Math.Max(x1, x2) - Math.Min(x1, x2);
  14.         double height = Math.Max(y1, y2) - Math.Min(y1, y2);
  15.  
  16.         Console.WriteLine("Area = " + width * height);
  17.         Console.WriteLine("Perimeter = " + 2 * (width + height));
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment