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 oddeven
{
public static void main(String arg[])
{
int number;
try
{
DataInputStream x=new DataInputStream(System.in);
System.out.println("Enter a number :");
number=Integer.parseInt(x.readLine());
if(number%2==0)
{
System.out.println("Number is Even");
}
else
{
System.out.println("Number is Odd");
}
}
catch(Exception e)
{
}
}
}
=========================================================================
Output :
Enter a number :
7
Number is Odd
No comments:
Post a Comment