a) rand() generates a random number between 0 and 32,767 (at least)
b) rand() % 7 generates a random number between 0 and 6
c) So, rand() % 7 + 5 generates a random number between (0+5) = 5 and (6+5) = 11
d) From that you should be able to write a simple sum to generate a random number between 5 and 7. Hint: 5= 0+5, 6=1+5 and 7=2+5