java代码逆序输出数字

总结:请告诉我更好的方法~~~总觉得不好。

package com.badu;

import java.util.Scanner;
//逆序输出数字:
//

class fa {

	public static void main(String[] args) {

		Scanner c = new Scanner(System.in);

		System.out.println("请输入数字----");

		int a = c.nextInt();

		// int b;

		int d = 0;

		System.out.println("需要处理的数:" + a);

		System.out.print("处理后的数:");

		while (a > 0) {

			d = a % 10;

			System.out.print("" + d);

			a = a / 10;

		}

	}

}//
请输入数字----
63465
需要处理的数:63465
处理后的数:56436

  

原文地址:https://www.cnblogs.com/langlove/p/3409636.html