import java.util.Scanner;
public class TestInvert {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("请输入一个正整数:");
int num = input.nextInt();
if (num == 0) {
System.out.println(0);
}
if (num > 0) {
if (num % 10 == 0) {
for (; num % 10 == 0; ) {
num /= 10;
}
for (; num != 0; ) {
System.out.print(num % 10);
num /= 10;
}
}
if (num % 10 != 0) {
for (; num != 0; ) {
System.out.print(num % 10);
num /= 10;
}
}
} else {
System.out.println("输入有误,请重新输入");
}
}
}
输入一个正整数[位数不限],将数据倒叙[数字一个完整数字]
最新推荐文章于 2023-04-05 12:45:00 发布