Since there are 26 letters in the alphabet, you can use
% 26 to start from the beginning again after z.
The character 'a' is not 0 however, so you need to subtract it first and then later re-add it.
For example:
for (int i = 0; i < n; i++) {
printf("%c", (a - 'a' + i) % 26 + 'a');
}