For example getting the factorial of a number I managed to do on my own (please ignore any dumb code)

int num = 5; int factorial = num; for(int i = 1; i < num; i++) { factorial*= i; }

But the book asked for it in reverse 5 * 4 * 3 * 2 * 1

I couldn't figure it out in reverse but it was so simple when I looked at a solution!

int num = 5; int factorial = 1; for(i=num; i > 1; num--) { factorial *= num; }

Is this (problem solving) something that develops with experience and practice?