Sum of matrix in which each element is absolute difference of its row and column numbers | C # program to find sum of matrix in which each element is absolute difference of its corresponding row and column number row . ; Retuen the sum of matrix in which each element is absolute difference of its corresponding row and column number row ; Driver Code
using System ; class GFG { static int findSum ( int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += i * ( n - i ) ; return 2 * sum ; } static public void Main ( String [ ] args ) { int n = 3 ; Console . WriteLine ( findSum ( n ) ) ; } }