//Chapter 2
//Program 3
//Nested if else in Java
import
java.util.Scanner;
public
class nestedifelse
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int n;
System.out.println("Enter
Year");
n=sc.nextInt();
if(n%100==0)
{
if(n%400==0)
{
System.out.println("leap
year");
}
else
{
System.out.println("Not a
leap year");
}
}
else if(n%4==0)
{
System.out.println("leap
year");
}
else
{
System.out.println("not a leap
year");
}
}
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.