(BlueJ) Java Program to Reverse a Given no.
Code:
class Reverse{
public static void main(int num){
int remainder, result=0;
while(num>0){
remainder = num%10;
result = result * 10 + remainder;
num = num/10;
}
System.out.println("Reverse number is : "+result);
}
}
Comment below for your Query and Feedback... :)public static void main(int num){
int remainder, result=0;
while(num>0){
remainder = num%10;
result = result * 10 + remainder;
num = num/10;
}
System.out.println("Reverse number is : "+result);
}
}
0 comments:
Confused? Feel free to ask
Post a Comment