import java.io.*;
class outter
{
int no=512,rem,rev=0,a;
public void print()
{
inner i=new inner();
a=i.cal(rev);
System.out.println("reverse of given number is = "+a);
}
class inner
{
public int cal(int rev)
{
while(no!=0)
{
rem=no%10;
rev=rev*10+rem;
no=no/10;
}
return(rev);
}
}
}
class innerclass_simple_reverse
{
public static void main(String args[])
{
outter o=new outter();
o.print();
}
}
class outter
{
int no=512,rem,rev=0,a;
public void print()
{
inner i=new inner();
a=i.cal(rev);
System.out.println("reverse of given number is = "+a);
}
class inner
{
public int cal(int rev)
{
while(no!=0)
{
rem=no%10;
rev=rev*10+rem;
no=no/10;
}
return(rev);
}
}
}
class innerclass_simple_reverse
{
public static void main(String args[])
{
outter o=new outter();
o.print();
}
}
No comments:
Post a Comment