Iterate through every index from a to b and call setbit ( ) if it is a multiple of 2 or 5
for ( int i = a ; i <= b ; i ++ ) if ( i % 2 == 0 i % 5 == 0 ) setbit ( array , i - a ) ; cout << " MULTIPLES ▁ of ▁ 2 ▁ and ▁ 5 : STRNEWLINE " ; for ( int i = a ; i <= b ; i ++ ) if ( checkbit ( array , i - a ) ) cout << i << " ▁ " ; return 0 ; }