Check if integer is multiple of 8
Use the "modulo" operator, which gives the remainder from division:
if (n % 8 == 0) {
// n is a multiple of 8
}
Use the "modulo" or "integer remainder operator" %
:
int a = ....;
if (a % 8 == 0 ) {
// a is amultiple of 8
}
if ( num % 8 == 0 )
{
// num is multple of 8
}