import java.io.*;
class outter
{
int no,rem,rev=0,a;
public void print()
{
try
{
DataInputStream cin=new DataInputStream(System.in);
System.out.println("Enter the number");
no=Integer.parseInt(cin.readLine());
}
catch(Exception e)
{
System.out.println("wrong data");
}
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_simple2_reverse
{
public static void main(String args[])
{
outter o=new outter();
o.print();
}
}
class outter
{
int no,rem,rev=0,a;
public void print()
{
try
{
DataInputStream cin=new DataInputStream(System.in);
System.out.println("Enter the number");
no=Integer.parseInt(cin.readLine());
}
catch(Exception e)
{
System.out.println("wrong data");
}
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_simple2_reverse
{
public static void main(String args[])
{
outter o=new outter();
o.print();
}
}
No comments:
Post a Comment