Example to practice
10 int shuffle(int x);
/*
This function interchanges odd-numbered and even-numbered
digits of x (counting from the leftmost digit). If x has
odd number of digits, the rightmost one remains intact.
For example,
x = 17 => result = 71
x = 20 => result = 02 (that is, 2)
x = 2005 => result = 0250 (that is, 250)
x = 135 => result = 315
x = 34576 => result = 43756
****/
20 int main()
21 {
22 int y,z;
23 y=2005;
24 z=11;
25 while (y>z) /* loop begins */
26 {
27 if ((y%z)!=0)
28 {
29 printf("Case 1. [Shuffling $%d! Incrementing #%d.]\n",y,z);
30 y=shuffle(y);
31 z++;
32 }
33 else
34 {
35 printf("Case 2. (Reducing %d. Shuffling %d)\n",y,z);
36 y= (y/z) - 1;
37 z=shuffle(z)-1;
38 }
39 }/* loop ends */
40
41 printf("Done. y=%d, z=%d\n", z,y);
42 return(0);
43 }