text: Minimum length of the shortest path of a triangle | C # program to illustrate the above problem ; function to get the minimum length of the shorter side of the triangle ; traversing through each points on the plane ; if sum of a points is greater than the previous one , the maximum gets replaced ; print the length ; Driver code ; initialize the number of points ; points on the plane
code: using System ; class GFG { static void shortestLength ( int n , int [ ] x , int [ ] y ) { int answer = 0 ; int i = 0 ; while ( n != 0 && i < x . Length ) { if ( x [ i ] + y [ i ] > answer ) answer = x [ i ] + y [ i ] ; i ++ ; } Console . WriteLine ( " Length ▁ - > ▁ " + answer ) ; Console . WriteLine ( " Path ▁ - > ▁ " + " ( ▁ 1 , ▁ " + answer + " ▁ ) " + " and ▁ ( ▁ " + answer + " , ▁ 1 ▁ ) " ) ; } static public void Main ( ) { int n = 4 ; int [ ] x = new int [ ] { 1 , 4 , 2 , 1 } ; int [ ] y = new int [ ] { 4 , 1 , 1 , 2 } ; shortestLength ( n , x , y ) ; } }