Friday 13 September 2013

Java on JCreator (creating a LEAP YEAR program using while loop)

Java on JCreator (creating a LEAP YEAR program using while loop)

public class LeapYear_2 {
public static void main(String[] args) {
int year = 1900;
while (year <= 2100 && (year % 4 == 0)){
System.out.println(year + " Is a Leap Year");
year++;
System.out.println(year + " Is not a leap year");
year++;
}
}
} // i just want to know if whats wrong with my Codes?... i want to create
a program that year 1900 to 2100 will show the leap year and which is NOT
i just dont know how to use while with many conditions... it seem that i
have to have many condition in while loop in order for this program to
work as i want to... THanks!

No comments:

Post a Comment