Think of an old fashioned car odometer, with three wheels displaying their digit.
Now use three nested for loops, and don't over-complicate it. Let the loops do their magic. No if's, no else's, no bs. Easy as pie. ;)
int w1, w2, w3; //wheel 1, wheel 2, wheel 3
for(w1=1;w1<10;w1++) {
for(w2=1;w2<10;w2++) {
for(w3=1;w3<10;w3++) {
printf(\n %d %d %d", w1, w2, w3);
}
}
}
Try that, see if you understand it.