题解 | #数字颠倒#
数字颠倒
https://www.nowcoder.com/practice/ae809795fca34687a48b172186e3dafe
import java.util.Scanner; public class Hj11 { //输入一个整数,将这个整数以字符串的形式逆序输出 //程序不考虑负数的情况,若数字含有0,则逆序形式也含有0,如输入为100,则输出为001 public static void main(String[] args) { Scanner scan = new Scanner(System.in); int number = scan.nextInt(); String str = number+""; StringBuilder stringBuilder = new StringBuilder(str).reverse(); System.out.println(stringBuilder); } }