Type the programs in NOTEPAD or DOS prompt itself, for Consol Application.
Type in NETBEANS or ECLIPSE for Window Application.
Here after , I am just typing the programs only..to know more about it , refer
Type in NETBEANS or ECLIPSE for Window Application.
Here after , I am just typing the programs only..to know more about it , refer
Introduction to JAVA
before doing any JAVA Programs.
***********************************************************************************************
import java.io.*;
class reverse
{
public static void main(String args[])
{
int r,n;
int rev=0;
try
{
DataInputStream x=new DataInputStream(System.in);
System.out.println("Enter a number :");
n=Integer.parseInt(x.readLine());
while(n>0);
{
r=n%10;
rev=rev*10+r;
n=(int)(n/10);
}
System.out.println("Number Reversed is :"+rev);
}
catch(Exception e)
{
}
}
}
=========================================================================
Output :
Enter a number :
143
Number Reversed is :
341
No comments:
Post a Comment