Check if sums of i | C # program to check if there are two adjacent set bits . ; Function to check the if sum of a row is same as corresponding column ; Driver code ; number of rows ; number of columns
using System ; class GFG { static bool areSumSame ( int [ , ] a , int n , int m ) { int sum1 = 0 , sum2 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum1 = 0 ; sum2 = 0 ; for ( int j = 0 ; j < m ; j ++ ) { sum1 += a [ i , j ] ; sum2 += a [ j , i ] ; } if ( sum1 == sum2 ) return true ; } return false ; } public static void Main ( ) { int n = 4 ; int m = 4 ; int [ , ] M = { { 1 , 2 , 3 , 4 } , { 9 , 5 , 3 , 1 } , { 0 , 3 , 5 , 6 } , { 0 , 4 , 5 , 6 } } ; if ( areSumSame ( M , n , m ) == true ) Console . Write ( "1 STRNEWLINE " ) ; else Console . Write ( "0 STRNEWLINE " ) ; } }