if(x2 >= 10) { while(x2 >= 10) { y2 = y2 * 10 + x2%10; x2 = x2/10; } y2 = y2 * 10 + x2; } else { y2 = x2; }