Friday, August 7, 2009

Leap year - java code

import java.io.*;
class Leapyear
{
public static void main(String[] args) throws IOException
{
BufferedReader object = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the year");
int year=Integer.parseInt(object.readLine());
System.out.println("The year entered is:"+year);
if (year%4==0){
System.out.println("The given year is a leap year");
}
else{
System.out.println("This is not a leap year");
}
}
}

No comments:

Post a Comment