• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

SoftwareTestingo - Interview Questions, Tutorial & Test Cases Template Examples

SoftwareTestingo - Interview Questions, Tutorial & Test Cases Template Examples

  • Home
  • Interview Questions
  • Java
  • Java Programs
  • Selenium
  • Selenium Programs
  • Manual Testing
  • Test Cases
  • Difference
  • Tools
  • SQL
  • Contact Us
  • Search
SoftwareTestingo » Java » Java Programs » Write a Program to Find out LeapYear In Java With Example Program?

Write a Program to Find out LeapYear In Java With Example Program?

Last Updated on: April 12, 2019 By Softwaretestingo Editorial Board

What We Are Learn On This Post

  • LeapYear Find In Java

LeapYear Find In Java

Write a Program to Find out Leap Year In Java With Example Program?

package com.java.Softwaretestingblog;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class FindLeapYear {
   public static void main(String[] args) throws NumberFormatException, IOException {
      // TODO Auto-generated method stub
      BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
      System.out.println("Enter A Year");
      int year=Integer.parseInt(br.readLine());

      //Century year divisible by 400
      if(year%100==0 && year%400==0)
         System.out.println("it is leap year");
      else if(year%100!=0 && year%4==0)
         System.out.println("it is leap year");
      else
         System.out.println("it is not leap year");
   }
}

Output:

Enter A Year
2000
it is leap year

    Filed Under: Java Programs

    Reader Interactions

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *

    Primary Sidebar

    Join SoftwareTestingo Telegram Group

    Categories

    Copyright © 2022 SoftwareTestingo.com ~ Contact Us ~ Sitemap ~ Privacy Policy ~ Testing Careers