Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners leap year logic

Have Programming Question? Ask it here!
 
 
 


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



Advertisement
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."); } } } Thanks
Advertisements
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
Leap Year Program
the user if it's a leap year or not. It uses boolean operators instead... whether a give year is leap year or not. // Michael Maus, 22 Sept 2004 import... String leapResult; // Tell's whether it's a leap year
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"
Logic and desgin
Logic and desgin  How would this be put in visual logic symbol
wrong year
wrong year..   I think u are using other calendar Check Settings
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
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
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
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
Business logic vs Presentation logic - JSP-Servlet
Business logic vs Presentation logic  what is the difference between Business logic and Presentation logic
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
What is programming logic ?
What is programming logic ?  What is programming logic
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
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
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
the business logic is executed.
the business logic is executed.  In which method of Action class the business logic is executed
WEB LOGIC - JSP-Servlet
WEB LOGIC project  I want the procedure to run a project in we logic server
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 the logic of this pattern?
what is the logic of this pattern?   1 121 12321 1234321
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
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
logic iterate tag - Struts
logic iterate tag  Hey I am displaying the values in a jsp called categoryView.jsp using logic iterate tag as Now properties bname and quant belongs to another formbean named as ViewCategoryForm.java.When I
logic for c language
logic for c language  01 02 03 04 05 06 20 21 22 23 24 07 19 32 33 34 25 08 18 31 36 35 26 09 17 30 29 28 27 10 16 15 14 13 12 11
Tell us the logic of diceroller
Tell us the logic of diceroller  import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class DiceRollerServlet extends... is " +dice2); } } dice1 =3 dice2 =2 How is the logic executed????   
Logic error? HELP PLEASE! :(
Logic error? HELP PLEASE! :(  Hello Guys! i have a huge problem. What..."); String MakeYear = rs.getString("car_year_of_make..._model(carmodel); retrievebean.setCar_year_of_make(MakeYear
Please explain the logic....
Please explain the logic....  class A1 { } class B extends A1 { } public class ComingThru { static String s = "-"; public static void main(String[] args) { A1[] aa = new A1[2]; B[] ba = new B[2
ATM Logic - Java Beginners
ATM Logic   Q-In an ATM program i want to print the receipt in which there is information of rupees note that come out from an ATM machine when user enters the particular amount. For e.g. if user enters 2250 then he should get
Business Logic in mvc2 - JSP-Servlet
Business Logic in mvc2  What is business logic and where it is written using servlet and jsp
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
struts logic:iterate tag
struts logic:iterate tag  Hi All, I am writing a look up jsp which is using logc:iterate every thing is fine except this the problem here is unable to go inside the tag. Here is the stack trace I am getting. [#|2010-10-27T00
Calendar
of the Gregoriancalendar class and also checking whether the year is leap or not and printing... format of the days for this month. We are also checking whether the year is leap or not. Description of program:  In the given example first we
Struts Logic Tags
Struts Logic Tags       Struts Logic Tags examples. Introduction to Struts Logic Tags Struts logic tags are conditional tags that replaces
Java converts any given year to Roman Numeral
Java converts any given year to Roman Numeral  Write a program that converts any given year to Roman Numeral
what's the logic for create pattern program
what's the logic for create pattern program   1 2 3 4 5 5 1 2 3 4 4 5 1 2 3 3 4 5 1 2 2 3 4 5 1
why business logic in servlets - JSP-Interview Questions
why business logic in servlets  why business logic written using servlets not in jsp. Jsp used for presentation purpose. serlvet used for coding business logic and controller logic. Reason for using servlets in business logic
Add year to Date without using Calendar in java
Add year to Date without using Calendar in java  how could i add a year to a date function without using calendar functions
Advertisements
 

 

 

DMCA.com