Write a program to input year and check whether it is a) a century leap year b) a century year but not a leap year c) a leap year or not Sample input: 2000 Sample output: it is a century leap year note: read this program in Java without using buffer reader
Answers
Answered by
20
import java.util.Scanner;
public class Year1
{
void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("enter a no.");
int a=sc.nextInt();
if (a%100==0 && a%400==0)
System.out.println("leap year");
else if (a%100!=0 && a%4==0)
System.out.println("leap year");
else
System.out.println("non leap year");
}
}
Similar questions