Basic java program to revere a number
/*Write a program to Reverse a given no. */
class Reverse{
public static void main(String args[]){
//take argument as command line
int num = Integer.parseInt(args[0]);
int remainder, result=0;
while(num>0){
remainder = num%10;
result = result * 10 + remainder;
num = num/10;
}
System.out.println("Reverse number is : "+result);
}
}
Subscribe to:
Post Comments (Atom)
0 komentar:
Post a Comment