Previously we have discussed the Program for
Java Program to Count Numbers of Characters From String ?
This Program is to check that year is leap year or not .
public class CheckLeap {
static void show(int year){
if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))) {
System.out.println(year+" IS LEAP YEAR");
} else {
System.err.println(year+" IS NOT LEAP YEAR");
}
}
public static void main(String[] args) {
show(2015);
show(2016);
}
}
Program Output :-
2016 IS LEAP YEAR
2015 IS NOT LEAP YEAR
Java Program to Count Numbers of Characters From String ?
This Program is to check that year is leap year or not .
public class CheckLeap {
static void show(int year){
if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))) {
System.out.println(year+" IS LEAP YEAR");
} else {
System.err.println(year+" IS NOT LEAP YEAR");
}
}
public static void main(String[] args) {
show(2015);
show(2016);
}
}
Program Output :-
2016 IS LEAP YEAR
2015 IS NOT LEAP YEAR

No comments:
Post a Comment