Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _03._2DRectangleArea
- {
- class Program
- {
- static void Main(string[] args)
- {
- double x1 = double.Parse(Console.ReadLine());
- double y1 = double.Parse(Console.ReadLine());
- double x2 = double.Parse(Console.ReadLine());
- double y2 = double.Parse(Console.ReadLine());
- double length = Math.Abs(x1 - x2);
- double width = Math.Abs(y1 - y2);
- double area = length * width;
- double perimeter = 2 * (length + width);
- Console.WriteLine($"{area:F2}");
- Console.WriteLine($"{perimeter:F2}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement