Anda di halaman 1dari 2

package javaapplication40;

import java.util.*;

public class JavaApplication40 {

public static void main(String[] args) {

Scanner leer=new Scanner(System.in);

do{

int n=leer.nextInt();

int cd=contDig(n);

}while(cd%2==1);

int c=0;

int n1=0;

while (c<cd/2){

int dig =n%10;

n=n/10;

n1=n1*10+dig;

c=c+1;

int cen =n%10;

n=n/10;

int n2 = invertido (n1);

n2 = n2*10+ cen;

n=(n2*math.pow(10,cd/2)+n);

System.out.println(""+n);

public static int contDig(int n){

int c,d;

c=0;

while (n>0) {
d=n%10;

c=c+1;

n=n/10;

return(c);

public static int invertido(int n1){

int s=0;

while (n1>0) {

int d=n1%10;

s=s*10+d;

n1=n1/10;

return(s);