 <pre><code>void move_digits(int a) { int digits = 0; int b = a; while(b / 10 ){ digits++; b = b / 10; } for (int i = 0; i &lt; digits; ++i) { int c = a / 10; int d = a % 10; int res = c + pow(10, digits) * d; printf("%d\n", res); a = res; } printf("\n"); } int main() { move_digits(12345); } </code></pre>