public static void Main()
Console.WriteLine(IsInRectangle(1,1,0,0,2,2));
Console.WriteLine(IsInRectangle(1,1,2,2,0,0));
Console.WriteLine(IsInRectangle(0,0,1,1,2,2));
Console.WriteLine(IsInRectangle(-1,-1,0,0,-2,-2));
Console.WriteLine(IsInRectangle(-3,-3,-2,-2,0,0));
Console.WriteLine(IsInRectangle(2, 2, 1, 1, 2, 2));
Console.WriteLine(IsInRectangle(-1, -1, 1, 1, -1, -1));
static bool IsInRectangle(int x, int y, int leftX, int topY, int rightX, int bottomY)
SwapCoordinates(ref rightX, ref leftX);
SwapCoordinates(ref topY, ref bottomY);
var yInsideRectangle = y >= bottomY && y <= topY;
var xInsideRectangle = x >= leftX && y <= rightX;
return xInsideRectangle && yInsideRectangle;
static void SwapCoordinates(ref int x1, ref int x2)