Check if it is possible to reach destination in even number of steps in an Infinite Matrix | C # program for the above approach ; Function to check destination can be reached from source in even number of steps ; Coordinates differences ; Minimum number of steps required ; Minsteps is even ; Minsteps is odd ; Driver code ; Given Input ; Function Call
using System ; class GFG { static void IsEvenPath ( int [ ] Source , int [ ] Destination ) { int x_dif = Math . Abs ( Source [ 0 ] - Destination [ 0 ] ) ; int y_dif = Math . Abs ( Source [ 1 ] - Destination [ 1 ] ) ; int minsteps = x_dif + y_dif ; if ( minsteps % 2 == 0 ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } public static void Main ( string [ ] args ) { int [ ] Source = { 2 , 1 } ; int [ ] Destination = { 1 , 4 } ; IsEvenPath ( Source , Destination ) ; } }