-->
import
java.io.BufferedReader;
import
java.io.IOException;
import
java.io.InputStreamReader;
public
class
java3 {
public
static
void
main(String[] args) throws
NumberFormatException, IOException {
//
TODO
Auto-generated method stub
int
no,i,rev=0;
System.out.println("Please
Enter the number which has to be reversed");
BufferedReader
br =new
BufferedReader(new
InputStreamReader(System.in));
no=Integer.parseInt(br.readLine());
System.out.println("The
Entered number is "+no);
while(no>0)
{
rev=rev*10;
i=no%10;
rev+=i;
no=no/10;
}
System.out.println("The
Reverse Version of given number is "+rev);
}
}
In the above program class name is java3.When the program is run Please Enter the number which has to be reversed message is displayed.Enter a number in the console and click enter button.The value is reversed and displayed as output in the console.The output is displayed with the message The Reverse Version of given number is ,followed by the reverse of the input number
In the above program class name is java3.When the program is run Please Enter the number which has to be reversed message is displayed.Enter a number in the console and click enter button.The value is reversed and displayed as output in the console.The output is displayed with the message The Reverse Version of given number is ,followed by the reverse of the input number