text: Check if a number is divisible by 8 using bitwise operators | C # program to check whether the number is divisible by 8 or not using bitwise operator ; function to check number is div by 8 or not using bitwise operator ; Driver code
code: using System ; class GFG { static bool Div_by_8 ( int n ) { return ( ( ( n >> 3 ) << 3 ) == n ) ; } public static void Main ( ) { int n = 16 ; if ( Div_by_8 ( n ) ) Console . WriteLine ( " YES " ) ; else Console . WriteLine ( " NO " ) ; } }