Io lavorerei sul modulo e sulla divisione per 10

codice:
#include <stdio.h>

int main()
{
    unsigned n = 18237;
    unsigned inv = 0;
    unsigned temp = n;
	while (temp != 0)
	{
	    inv = inv * 10 + temp % 10;
	    temp /= 10;	
	}
	printf("prima: %d\ndopo %d", n, inv);

    return 0;
}