package com.test;
import java.util.Scanner;
public class TestNet {
public static void main(String[] args) {
int n ;
Scanner scByte = new Scanner(System.in);
n= scByte.nextInt();
System.out.println(reverse(n));
}
public static int reverse(int i ){
int s ,j =0;
s= i;
while(s !=0){
j = j*10+s%10; //取出最低位上的数字 ,依次得到反转的数字
s=s/10; //降位
}
return j;
}
}
最后
以上就是坦率百合最近收集整理的关于java 输入一个数字,反转(倒置)输出这个数字的值的全部内容,更多相关java内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复