text: Compute modulus division by a power | C # code for Compute modulus division by a power - of - 2 - number ; This function will return n % d . d must be one of : 1 , 2 , 4 , 8 , 16 , 32 , ... ; Driver code ; d must be a power of 2
code: using System ; class GFG { static uint getModulo ( uint n , uint d ) { return ( n & ( d - 1 ) ) ; } static public void Main ( ) { uint n = 6 ; uint d = 4 ; Console . WriteLine ( n + " ▁ moduo ▁ " + d + " ▁ is ▁ " + getModulo ( n , d ) ) ; } }