/* Write a java code which has Boolean function returning a string to display whether it is a leap year or not.Accept the year from the user. AIM:To check whether the given year is a leap year or not using boolean function */ import java.io.*; class year { public static void main(String args[])throws IOException { DataInputStream in = new DataInputStream(System.in); int year; String str; System.out.println("enter the year"); str =in.readLine(); year = Integer.parseInt(str); if(leap_year(year)) System.out.println(year+" is a leap year"); else System.out.println(year+" is not a leap year"); } //Main program ends and function begins static boolean leap_year(int yr) { if(yr % 400 == 0) return true; if(yr % 100 == 0) return false; if (yr % 4 == 0) return true; else return false; } }