Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _2D_Rectangle_Area
- {
- 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 area = Math.Abs((x1 - x2) * (y2 - y1));
- double perimeter = Math.Abs(2 * ((x1 - x2) + (y2 - y1)));
- Console.WriteLine($"{area:f2}");
- Console.WriteLine($"{perimeter:f2}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement