Skip to content

Instantly share code, notes, and snippets.

@wdfx100
Created December 6, 2012 03:55
Show Gist options
  • Save wdfx100/4221654 to your computer and use it in GitHub Desktop.
Save wdfx100/4221654 to your computer and use it in GitHub Desktop.
数字取反
//数字取反
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