Largest set with bitwise OR equal to n | C # Program to find the largest set with bitwise OR equal to n ; function to find the largest set with bitwise OR equal to n ; If the bitwise OR of n and i is equal to n , then include i in the set ; Driver Code
using System ; using System . Collections . Generic ; class GFG { static void setBitwiseORk ( int n ) { List < int > v = new List < int > ( ) ; for ( int i = 0 ; i <= n ; i ++ ) { if ( ( i n ) == n ) { v . Add ( i ) ; } } for ( int i = 0 ; i < v . Count ; i ++ ) { Console . Write ( v [ i ] + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int n = 5 ; setBitwiseORk ( n ) ; } }