Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _2D_Rectangle_Area
  4. {
  5. class Program
  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 area = Math.Abs((x1 - x2) * (y2 - y1));
  15. double perimeter = Math.Abs(2 * ((x1 - x2) + (y2 - y1)));
  16.  
  17. Console.WriteLine($"{area:f2}");
  18. Console.WriteLine($"{perimeter:f2}");
  19.  
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement