ProgrammingModerateTCS NQT · Infosys

How many integers from 1 to 30 are multiples of 8?

  1. A. 4
  2. B. 3
  3. C. 2
  4. D. 30

Correct answer: B. 3

The multiples are 8, 16 and 24, so the count is 3. Testing n & 7 == 0 is the bit form of the same check.

More C Programming questions

Exams that ask this topic