Program to Check Leap Year or Not by - Java2021 - Java2021 : Online Tutorials Hub

Java2021 : Online Tutorials Hub

JAVA | Advance Java | MySQL | Data Structure | Git | HTML | CSS | JS

Latest

Post Top Ad

Program to Check Leap Year or Not by - Java2021

Write a program to leap year or not 
package Programs;
import java.util.Scanner;
public class LeapYear {
    public static void main(String[] args) {
        int x;
        System.out.println("enter the year");
        Scanner scanner=new Scanner(System.in);
        x=scanner.nextInt();
        if ((x%4==0&&(x%100!=0)||(x%400==0)))
        {
            System.out.println("leap year");
        }
        else {
            System.out.println("not a leap year");
        }
    }
}
Output : 






Click to next or Start with your Choice
-Important Programs for Freshers
Sorting and Searching Programs
Learn Pattern Programs 
Click to learn Array Programs
Click to Learn MySQL 
for any complaint regarding my Blog please visit contact us page and write what problem you have!

No comments:

Pages