Computer Science, asked by tanmaytodi299, 7 months ago

Write a java program to input any year and check it is leap year or not .​

Answers

Answered by ArnavGamer
7

Answer:

import java.util.Scanner;

public class Check_Leap_Year

{

public static void main(String args[])

{

Scanner s = new Scanner(System.in);

System.out.print("Enter any year:");

int year = s.nextInt();

boolean flag = false;

if(year % 400 == 0)

{

flag = true;

}

else if (year % 100 == 0)

{

flag = false;

}

else if(year % 4 == 0)

{

flag = true;

}

else

{

flag = false;

}

if(flag)

{

System.out.println("Year "+year+" is a Leap Year");

}

else

{

System.out.println("Year "+year+" is not a Leap Year");

}

}

}

I hope it's helpful for you if yes then mark me brainliest

Similar questions