java 反向打印一个数字
//print all digits of the given number import java.util.Scanner; public class Numbers { public static void main(String[] args) { int num; Scanner ip = new Scanner(System.in); System.out.print("Enter a number: "); num = ip.nextInt(); while (num > 0) { int rem = num % 10; System.out.println(rem); num = num / 10; } ip.close(); } } OUTPUT: Enter a number: 32451234 4 3 2 1 5 4 2 3