Advertisement
Kuncavia

2DRectangleArea

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