Find bitwise AND ( & ) of all possible sub | C # program to find of all the sub - arrays ; function to return AND of sub - arrays ; Driver code ; size of the array ; print and of all subarrays
using System ; public class GFG { static int AND ( int [ ] a , int n ) { int ans = a [ 0 ] ; for ( int i = 0 ; i < n ; ++ i ) ans &= a [ i ] ; return ans ; } public static void Main ( ) { int [ ] a = { 1 , 2 , 3 } ; int n = a . Length ; Console . WriteLine ( AND ( a , n ) ) ; } }