You are almost there! The function rand()returns a random value in a rather large range (from 0 to RAND_MAX). Using the module operator reduces it down to a smaller range (from 0 to 9, since you are modding by 10), and then +1 moves this value from 1 to 10.
To get values from 0 to 10, you can take randand change its value to 11:
r = rand() % 11;
In general, to get random values in the range [0, n], you can write
r = rand() % (n + 1);
, , [k, n + k],
r = rand() % (n + 1) + k;
, , , modding rand() . ( ), , , rand().