Print all submasks of a given mask | C # program for the above approach ; Function to print the submasks of N ; Driver Code
using System ; class GFG { static void SubMasks ( int N ) { for ( int S = N ; S > 0 ; S = ( S - 1 ) & N ) { Console . Write ( S + " ▁ " ) ; } } static public void Main ( ) { int N = 25 ; SubMasks ( N ) ; } }