Program 8 :: LeapYear

// Program :: Write a Java Program to finding the LeapYear import java.io.*;

public class LeapYear {
public static boolean isLeapYear(int year)
{
if( year % 4 != 0 ){
return false;
}

if(( year % 400 != 0 ) && (year % 100 == 0)){
return false;
}else{
return true;
}
}

public static void main (String[] args){
int year = 0;
String input = "";
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
while(true){
System.out.println("Enter the year: ");
try {
input = in.readLine();
year = Integer.valueOf( input ).intValue();
} catch (IOException e) {
e.printStackTrace();
}
if(year < 0){break;}
System.out.print ("Is it a leap year? ");
System.out.println( isLeapYear(year) );
}
}
}
// Engr. Parag Ferdus 01713 400 421, 01914 949 399, 01670 876 388
// www.pfbd.yolasite.com paragferdus@gmail.com

Comments

Popular posts from this blog

মোবাইল ফোন হাত থেকে পড়লে কত সেকেন্ডের মধ্যে তুলে ফেললে ডিসপ্লে ভাঙবে না?

বাংলাদেশে Google Pay (GPay) নিয়ে বাস্তব অভিজ্ঞতা

What if... "Oppenheimer didn’t build the bomb” – A Butterfly Effect Narrative (2025 Alternate Reality)