Created
December 6, 2012 03:55
-
-
Save wdfx100/4221654 to your computer and use it in GitHub Desktop.
数字取反
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//数字取反 | |
java.util.Scanner input=new java.util.Scanner(System.in); | |
System.out.println("请输入要取反的数字:"); | |
int i=input.nextInt(); | |
do{ | |
int j=i%10; | |
System.out.print(j); | |
i=i/10; | |
if(i<10){ | |
System.out.print(i); | |
} | |
}while(i/10>0); | |
/* | |
int num=input.nextInt(); | |
int num1; | |
do{ | |
num1=num%10; | |
num=num/10;//最后一次直接输出 | |
System.out.print(num1); | |
}while(num>0); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment