Search This Blog

Friday, May 28, 2021

Find Leap Year source code (java)

 Find Leap Year


import java.util.Scanner;

public class LeapYear {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = 1;
        while (n==1){

        System.out.println("Enter the year: ");
        int y = sc.nextInt();

        if (y%4==0){
            System.out.println("Yes, it's a leap year");
        }
        else {
            System.out.println("No, it's not a leap year");
        }
        }
    }
}