Computer Science, asked by kiranbaskar2124, 3 days ago

algorithm for reverse number

Answers

Answered by samarthkrv
0

Answer:

public class ReverseNumberExample1    

{  

public static void main(String[] args)    

{  

int number = 987654, reverse = 0;  

while(number != 0)    

{  

int remainder = number % 10;  

reverse = reverse * 10 + remainder;  

number = number/10;  

}  

System.out.println("The reverse of the given number is: " + reverse);  

}  

}  

Explanation:

Similar questions