Social Sciences, asked by mithunhaldkar9963, 1 year ago

Write a java program that takes a year from the user and print wheather that year is a leap year or not?

Answers

Answered by rano2
0
#include<iostream.h>
#include <conio.h>
void main ()
{
for (int i=0;i>10;i++);
cout<<"leap year">>;
else
cout <<"not leap year">>;
getch();
Answered by sougatap57
0

Answer:

import java.util.*;

public class HelloWorld{

    public static void main(String []args){

      int a;

      Scanner sc=new Scanner(System.in);

      System.out.println("enter the year");

      a=sc.nextInt();

      if(((a%4==0)&&(a%100!=0))||(a%400==0))

      {

      System.out.println("leap year:"+a);

      }

      else

      {

          System.out.println("it is not a leap year:"+a);

      }

    }

}

Output

enter the year 2016

leap year:2016

Similar questions