leap year logic

leap year logic

View Answers

August 12, 2009 at 3:29 PM

Hi Friend,

Please visit the following link:

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.io.InputStreamReader;
import java.util.logging.Level;
import java.util.logging.Logger;

public class LeapYrDemo {
public static void main(String[] args) {
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
             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.io.InputStreamReader;

import java.util.logging.Level;

import java.util.logging.Logger;

public class LeapYrDemo {

public static void main(String[] args) {

        try {

            BufferedReader br = new BufferedReader(new 

            InputStreamReader(System.in));

 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
Advertisements
java leap year
whether itis a leap year. Aleap year is an integer greater than 1584...("It is a leap year."); } else{ System.out.println("It is not a leap...java leap year  write a java program that takes an input
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
ModuleNotFoundError: No module named 'leap'
ModuleNotFoundError: No module named 'leap'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'leap' How to remove the ModuleNotFoundError: No module named 'leap' error
ModuleNotFoundError: No module named 'leap'
ModuleNotFoundError: No module named 'leap'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'leap' How to remove the ModuleNotFoundError: No module named 'leap' error
ModuleNotFoundError: No module named 'leap'
ModuleNotFoundError: No module named 'leap'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'leap' How to remove the ModuleNotFoundError: No module named 'leap' error
ModuleNotFoundError: No module named 'leap-protocol'
ModuleNotFoundError: No module named 'leap-protocol'  Hi, My... 'leap-protocol' How to remove the ModuleNotFoundError: No module named 'leap-protocol' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'linggle-leap'
ModuleNotFoundError: No module named 'linggle-leap'  Hi, My Python... 'linggle-leap' How to remove the ModuleNotFoundError: No module named 'linggle-leap' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'leap-client'
ModuleNotFoundError: No module named 'leap-client'  Hi, My Python... 'leap-client' How to remove the ModuleNotFoundError: No module named 'leap-client' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'leap-client'
ModuleNotFoundError: No module named 'leap-client'  Hi, My Python... 'leap-client' How to remove the ModuleNotFoundError: No module named 'leap-client' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'leap_gwas'
ModuleNotFoundError: No module named 'leap_gwas'  Hi, My Python... 'leap_gwas' How to remove the ModuleNotFoundError: No module named 'leap... have to install padas library. You can install leap_gwas python with following
ModuleNotFoundError: No module named 'leap-server'
ModuleNotFoundError: No module named 'leap-server'  Hi, My Python... 'leap-server' How to remove the ModuleNotFoundError: No module named 'leap-server' error? Thanks   Hi, In your python environment
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"
ModuleNotFoundError: No module named 'leap-second-client'
ModuleNotFoundError: No module named 'leap-second-client'  Hi, My... named 'leap-second-client' How to remove the ModuleNotFoundError: No module named 'leap-second-client' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'mailpile-leap-adapter'
ModuleNotFoundError: No module named 'mailpile-leap-adapter'  Hi...: No module named 'mailpile-leap-adapter' How to remove the ModuleNotFoundError: No module named 'mailpile-leap-adapter' error? Thanks   Hi
wrong year
wrong year..ADS_TO_REPLACE_1   I think u are using other calendar Check
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
Mysql Year of Date
Mysql Year of Date       Mysql Year of Date is used to return the current year of the table... from 'Mysql Year of Date'. To understand and grasp the example we use
Business logic vs Presentation logic - JSP-Servlet
Business logic vs Presentation logic  what is the difference between Business logic and Presentation logic
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
Mysql Date Get Year
Mysql Date Get Year       Mysql Date Get Year is the way of retrieving the current year... 'Mysql Date Get Year'. To understand and grasp this example, we use
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
Mysql Date Add Year
Mysql Date Add Year       Mysql Date Add Year explains to add the year to the particular... an example from 'Mysql Date Add Year'. To graspe this example, we use Add
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
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
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
ModuleNotFoundError: No module named 'week-of-year'
ModuleNotFoundError: No module named 'week-of-year'  Hi, My Python... 'week-of-year' How to remove the ModuleNotFoundError: No module named 'week-of-year' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'logic'
ModuleNotFoundError: No module named 'logic'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'logic' How to remove the ModuleNotFoundError: No module named 'logic'
what is the logic of this pattern?
what is the logic of this pattern?   1 121 12321 1234321
How to Addding 1 Year with PHP
How to Addding 1 Year with PHP  Hi, I am very fresh in PHP language. I trying to create a small application about how to adding 1 year in specific date. Please suggest me. Thanks
Version of com.thesett>logic dependency
List of Version of com.thesett>logic dependency
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
About Web-Logic
the Web-Logic with Tomcat 5.0 version in Console. Somebody has suggested to see the webpage (they had given the link).But when i installed the Web-Logic i... folder in the Web-Logic
Struts logic iterate
Struts logic iterate  This is my jsp page in which i used 3 logic...; <%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>...; <body> <h1> Search </h1> <logic:iterate name
logic for pattern program
logic for pattern program  what's the logic for create pattern program how can i create any pattern program with in minute. like this 123454321... create this program in java without help whats the logic how can i understand
1 year masters in data science
1 year masters in data science  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: 1 year... that I can learn the topic "1 year masters in data science". Also tell

Ads