import javax.swing.JOptionPane;
public class leap
{ public static void main(String[] args) {
int i;
i=Integer.parseInt(JOptionPane.showInputDialog("enter an year"));
if((i%4==0 && i%100!=0) || (i%400==0))
{
System.out.print("leap year ");
}
else
System.out.print("no ");
}
}
output:
enter an year 1600
leap year
public class leap
{ public static void main(String[] args) {
int i;
i=Integer.parseInt(JOptionPane.showInputDialog("enter an year"));
if((i%4==0 && i%100!=0) || (i%400==0))
{
System.out.print("leap year ");
}
else
System.out.print("no ");
}
}
output:
enter an year 1600
leap year
No comments:
Post a Comment
SAY HELLO!!