Q:

Calculate The Given Year Is Leap or Not Using Java

0

This Program is used to calculate the given year is Leap or not using Java.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import java.io.*; 

class a25 
{ 
public static void main(String arg[]) throws IOException 
{ 
int n; 
BufferedReader inp= new BufferedReader(new InputStreamReader(System.in)); 
System.out.println("\n\t\t\tFinding Leap Year"); 
System.out.println("\n\t\t\t~~~~~~~~~~~~~~~~~"); 
System.out.print("\nEnter the Year: "); 
n=Integer.parseInt(inp.readLine()); 
if( (n%400==0)||( (n%100!=0)&& (n%4==0)) ) 
{ 
System.out.println("This Year "+n+" is a Leap Year"); 
} 
else 
{ 
System.out.println("This Year "+n+" is a not Leap Year"); 
} 
} 
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now