Advertisement
Guest User

Untitled

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