Coordinates of rectangle with given points lie inside | Program to find smallest rectangle to conquer all points ; function to print coordinate of smallest rectangle ; find Xmax and Xmin ; find Ymax and Ymin ; print all four coordinates ; Driver code
using System . Linq ; using System ; public class GFG { static void printRect ( int [ ] X , int [ ] Y , int n ) { int Xmax = X . Max ( ) ; int Xmin = X . Min ( ) ; int Ymax = Y . Max ( ) ; int Ymin = Y . Min ( ) ; Console . WriteLine ( " { " + Xmin + " , ▁ " + Ymin + " } " ) ; Console . WriteLine ( " { " + Xmin + " , ▁ " + Ymax + " } " ) ; Console . WriteLine ( " { " + Xmax + " , ▁ " + Ymax + " } " ) ; Console . WriteLine ( " { " + Xmax + " , ▁ " + Ymin + " } " ) ; } static public void Main ( ) { int [ ] X = { 4 , 3 , 6 , 1 , - 1 , 12 } ; int [ ] Y = { 4 , 1 , 10 , 3 , 7 , - 1 } ; int n = X . Length ; printRect ( X , Y , n ) ; } }