Finding the result with given condition
double res = ( pow ( 2 , i ) - 1 ) * ( pow ( 2 , j ) - 1 ) * pow ( 2 , n - i - j ) ; return res ; } int count ( int arr [ ] , int n , int value ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) if ( arr [ i ] == value ) sum ++ ; return sum ; }