# leap year logic

sreekanth
leap year logic
3 Answer(s)      8 years ago
Posted in : Java Beginners

August 12, 2009 at 3:29 PM

Hi Friend,

http://www.roseindia.net/java/beginners/Leapyear.shtml

Thanks

January 21, 2012 at 2:22 PM

```import java.io.BufferedReader;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

public class LeapYrDemo {
public static void main(String[] args) {
try {
System.out.println("Enter num");
int yr = br.read();

int num = yr;
if(num/100== 0){
if(num/400==0){
System.out.println("Leap year");
}
else
System.out.println("not leap yr");
}
else if(num/4==0){
System.out.println("leap yr");
}
else
System.out.println("Not a leap yr");

} catch (IOException ex) {
Logger.getLogger(LeapYrDemo.class.getName()).log(Level.SEVERE, null, ex);
}
}

}

OutPut:

Enter num
2012
Leap year
BUILD SUCCESSFUL (total time: 4 seconds)
```

January 21, 2012 at 2:24 PM

```import java.io.BufferedReader;

import java.io.IOException;

import java.util.logging.Level;

import java.util.logging.Logger;

public class LeapYrDemo {

public static void main(String[] args) {

try {

System.out.println("Enter num");

int yr = br.read();

int num = yr;

if(num/100== 0){

if(num/400==0){

System.out.println("Leap year");

}

else

System.out.println("not leap yr");

}

else if(num/4==0){

System.out.println("leap yr");

}

else

System.out.println("Not a leap yr");

} catch (IOException ex) {

Logger.getLogger(LeapYrDemo.class.getName()).log
(Level.SEVERE, null, ex);

}

}

}
```

Related Tutorials/Questions & Answers:
leap year logic - Java Beginners
leap year logic  hi frds.. can u give me logic for leap year..  Hi Friend, Please visit the following link: http://www.roseindia.net/java/beginners/Leapyear.shtml Thanks
leap year
leap year  how to create class for leap year. It is leap year...(); if (year.isLeapYear(y)){ System.out.println("It is a leap year."); } else{ System.out.println("It is not a leap year."); } } } Thanks
java leap year
whether itis a leap year. Aleap year is an integer greater than 1584...(); if (year.isLeapYear(y)){ System.out.println("It is a leap year."); } else{ System.out.println("It is not a leap year
Java Leap Year Problem
Java Leap Year Problem  I need help with a writing a program in Java that creates a class Year that contains a data field that holds the number of months in a year and the number of days in a year. It should include a get method
Checking whether a year is leap or not
Checking whether a year is leap or not   ... for checking whether a year is a leap year or not. Here, we have taken the year 2000. So...;if else" condition. As we know leap year is divided by the integer 4 and so
Determining If a Year is a Leap Year in Java
Determining If a Year is a Leap Year in Java       Leap Year: Leap Year is the year contains an extra day. In the leap year, February month contains 29 days since normally
leap
leap   Check the given year for leap year (Test Case: 2010, 2012 , 1900
LOGIC
LOGIC  hey guys..i have my exams coming in somedays and it would be really helpful if someone explained how to develop the logic of any program
LOGIC
LOGIC  hey guys..i have my exams coming in somedays and it would be really helpful if someone explained how to develop the logic of any program
Listing out leap years between certain period
.  As we know a leap year is divisible by 4, define an integer l=n%4. So if 'n' is divisible by 4 or l=0, then the particular year can be a leap year... will be a leap year. For listing out each year write "+n"
wrong year
wrong year..   I think u are using other calendar Check Settings
Logic and desgin
Logic and desgin  How would this be put in visual logic symbol
Logic Building
Logic Building  I wanted to devlop my logic ? How can i do so ? Can i start with java or i need to do c++ before
Logic Iterate.
Logic Iterate.  I have one doubt about logic:iterate. I use text feild inside of logic:iterate , there is possible will generate N no of rows (text feild) inside of iterate. my doubt is how to get the Paritcular rows text
Logic Iterate.
Logic Iterate.  logic iterate Struts I have one doubt about logic:iterate. I use text field inside of logic:iterate , there is possible... the Particular rows text value. for example: print("<logic:iterate id="xid
How to calculate days in a year
How to calculate days in a year  Hi, How to calculate no of days in a year? I want a program that calculates no of days in a year by specifying year... of calculating days in a year? Thanks
Business logic vs Presentation logic - JSP-Servlet
Business logic vs Presentation logic  what is the difference between Business logic and Presentation logic
Mysql Date Get Year
Mysql Date Get Year       Mysql Date Get Year is the way of retrieving the current year... Year'. To understand and grasp this example, we use the following syntax
Mysql Year of Date
Mysql Year of Date       Mysql Year of Date is used to return the current year of the table in database. Understand with Example The Tutorial illustrate an example from 'Mysql Year
Logic and Degin
Logic and Degin  Need help in writing a pseudocode for this can so please help me with this just need to get started. In this lab, you are going to extend the Fireworks Checkout Stand application in Week 6. This week, we
name of year in chinese
name of year in chinese   hello my name kiemtheng i'm come from Cambodia, i would to write java programming to calculate a name of year for each... out put . Enter day of birth: 02 Enter month of birth: 10 Enter year of birth
Logic and Design
Logic and Design  Please help me with this Write a program that prompts and accepts a number between 1 and 12. After getting the input, display the number with the appropriate month. (example: This is the 1st monthÂ¦January
logic-iterate
logic-iterate  in my code i am using for-each loop for displaying data i want use tag to display data how to use plase help me <%@ page import="java.sql.*" %> <%String[] id = (String[])session.getAttribute("ids
Mysql Date Add Year
Mysql Date Add Year       Mysql Date Add Year explains to add the year to the particular... 'Mysql Date Add Year'. To graspe this example, we use Add('2008-12-15',INTERVAL 1
name of year in chinese
name of year in chinese   hello my name kiemtheng i'm come from Cambodia, i would to write java programming to calculate a name of year for each birthday in Chinese but i dont know how to do.   import java.util.
What is programming logic ?
What is programming logic ?  What is programming logic
JSP Financial Year Table
JSP Financial Year Table  Im trying to design a financial year table...wherein the user enters the data in the table and the same is updated in backend.i have successfully desinged the page but i have certain doubts in jsp
WEB LOGIC - JSP-Servlet
WEB LOGIC project  I want the procedure to run a project in we logic server
the business logic is executed.
the business logic is executed.  In which method of Action class the business logic is executed
what is the logic of this pattern?
what is the logic of this pattern?   1 121 12321 1234321
struts logic tags
struts logic tags  what is the use of struts logic tag   The purpose of Struts logic tags is to alter output depending on the given...://www.roseindia.net/struts/struts-logictags/logic-tags-introduction.shtml http