如12340的逆序数为4321
java.util.Scanner;
class a{
public static void main(String[]args){
Scanner input=new Scanner(System.in);
int a=input.nextInt();
int num=0;
while(a!=0){
num=num*10+a%10;
a/=10;
}
System.out.println(num);
}
}
运行结果
如12340的逆序数为4321
java.util.Scanner;
class a{
public static void main(String[]args){
Scanner input=new Scanner(System.in);
int a=input.nextInt();
int num=0;
while(a!=0){
num=num*10+a%10;
a/=10;
}
System.out.println(num);
}
}
运行结果