Visual Paradigm Logo
     Build Quality Applications Faster, Better and Cheaper
 
Home | Products | Download | Documentation | Support | Resources | Partners | Quick Tour | Shop | Company |  
 
   Visual Paradigm Discussion Forum
  Login   [ Register ] Email: Password: Log me on automatically I lost my password  
Recent Topics
Advanced Search
java programming  
Forum Index -> Java Questions
Author Message
Anonymous

How can we reverse a number? Example the given number is 300. What method is used to make that number be reversed?
 
Anonymous

u can make its code. its so simple

int num=123;
int finalNum=0;

while(num>0){
int qt=num%10;
num=num/10;
finalNum=finalNum*10 + qt;
}

after completing loop, ur final value will be it's reverse i.e. finalNum will be 321
 
 
   Forum Index -> Java Questions
Go to:   
Powered by JForum 2.1.4 © 2005 - Rafael Steil