Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- import java.lang.*;
- import java.io.*;
- class Ideone
- {
- public static void main (String[] args) throws java.lang.Exception
- {
- System.out.println("Displaying the number of years between year 2000 and 2010: " + years(2000, 2010) );
- }
- public static int years(int start, int end)
- {
- int x;
- int days = 0;
- for (x=start; x<(end); x++)
- {
- if (x % 4 ==0 && x % 100 != 0 || x % 400 ==0)
- days += 366;
- else
- days += 365;
- }
- return days;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement