LEAPYEAR QUESTION 5
INSTITUTE OF PUBLIC ADMINSTATION AND MANAGEMENT(IPAM
MODULE: COMPUTER PROGRAMMING
COURSE:BSC IN INFOMATION TECHNOLOGY
YEAR 1
BY: NAOMI BALAMA MOORE
import java.util.Scanner;
public class leapyear {
public static void main(String[] args) {
System.out.println("Enter a number to determine if it is a leap year or not");
Scanner input = new Scanner(System.in);
while (!input.hasNextInt()){
System.out.println("Enter a whole number");
input.next();
}
int number;
number = input.nextInt();
if(number % 400== 0){
System.out.println(number + " " + "is a leap year");
}
else {
System.out.println(number + " " + "is not a leap year");
}
}
}
Comments
Post a Comment