Modify a binary array to Bitwise AND of all elements as 1 | C # implementation of the above approach ; Function to check if it is possible or not ; Driver code
using System ; class GFG { static bool check ( int [ ] a , int n ) { for ( int i = 0 ; i < n ; i ++ ) if ( a [ i ] == 1 ) return true ; return false ; } public static void Main ( ) { int [ ] a = { 0 , 1 , 0 , 1 } ; int n = a . Length ; if ( check ( a , n ) == true ) Console . Write ( " YES STRNEWLINE " ) ; else Console . Write ( " NO STRNEWLINE " ) ; } }