fbinnzhivko

07.2DRectangleArea

Mar 7th, 2016
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5.     static void Main()
  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.  
  12.        
  13.         var area = 2 * (Math.Abs(x2 - x1) + Math.Abs(y1 - y2));
  14.         var perimmeter = Math.Abs(x2 - x1) * Math.Abs(y1 - y2);
  15.  
  16.         Console.WriteLine("{0}", perimmeter);
  17.         Console.WriteLine("{0}", area);
  18.     }
  19. }
Add Comment
Please, Sign In to add comment