1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Bogdan [553]
4 years ago
5

A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To ac

count for the difference in time, every 4 years, a leap year takes place. A leap year is when a year has 366 days: An extra day, February 29th. The requirements for a given year to be a leap year are: 1) The year must be divisible by 4 2) If the year is a century year (1700, 1800, etc.), the year must be evenly divisible by 400 Some example leap years are 1600, 1712, and 2016. Write a program that takes in a year and determines whether that year is a leap year.
Computers and Technology
2 answers:
katrin [286]4 years ago
6 0

Answer:

i_year=int(input(""))

#check leap year

if((i_year % 4 == 0 and i_year % 100 != 0) or (i_year % 400 == 0)):

  print("{} is a leap year.".format(i_year))

else:

  print("{} is not a leap year.".format(i_year))

Explanation:

GREYUIT [131]4 years ago
4 0

Answer:

import java.util.Scanner;

public class LabProgram {

  public static void main(String[] args) {

      Scanner scnr = new Scanner(System.in);

      int inputYear;

      boolean isLeapYear;

      isLeapYear = false;

      inputYear = scnr.nextInt();

      // If a year is divisible by 400,  then it is a leap year

      if (inputYear % 400 == 0)

          isLeapYear = true;

      // If a year is divisible by 100,  then it is not a leap year

      if (inputYear % 100 == 0)

          isLeapYear = false;

      // If a year is divisible by 4,  then it is a leap year

      if (inputYear % 4 == 0)

          isLeapYear = true;

      if(isLeapYear)

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

      else

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

  }

}

Explanation:

  • Take the year as an input from user and store it to inputYear variable.
  • If the year is a century year, check if the year is divisible by 400 ( the year must be evenly divisible by 400 ),  then set the boolean isLeapYear to true. If a year is divisible by 100,  then set the boolean isLeapYear to false. If a year is divisible by 4,  then set the boolean isLeapYear to true.
  • Check if isLeapYear is true, then print that it is a leap year. Otherwise, print that it is not a leap year.

Output:

1712

1712 is a leap year.

You might be interested in
Can my cell phone provider keep track of my internet history?
dem82 [27]
Are they allowed to? No
Could they? Possibly
Hotel? Trivago
8 0
4 years ago
Write a program that asks length,breadth and height of a room and calculate its volume​
marta [7]

Answer:

cls

Input"enter length";l

Input"enter breadth";b

Input"enter height";h

v=l*b*h

print"the volume is";v

end

Explanation:

hope you got it

6 0
3 years ago
Advantages of communications​
poizon [28]

Answer:

promotes team building

creates better relationship

3 0
3 years ago
Read 2 more answers
8.2: Lottery Winners A lottery ticket buyer purchases 10 tickets a week, always playing the same 10 5-digit "lucky" combinations
julia-pushkina [17]
Idk bro but pick the first one that comes to mind
3 0
3 years ago
52 is same as 5x5 or 25
poizon [28]

Answer:

25

Explanation:

5 0
3 years ago
Read 2 more answers
Other questions:
  • What type of topography should Carlos choose?
    5·1 answer
  • An enterprise DBMS is automatically capable of serving as a mobile DBMS. There are no special issues raised by mobility. True Fa
    11·1 answer
  • Suppose a developer gets class XYZ files and documentation from a subcontractor. This class does not implement the Comparable in
    9·1 answer
  • Explain briefly why we say that the "Web" exists only in our minds.
    14·1 answer
  • Alice just wrote a new app using Python. She tested her code and noticed some of her lines of code are out of order. Which princ
    8·1 answer
  • What date does GTA 6 come out<br> A. 2020<br> B. 2019<br> C. 2021<br> D. 2022
    10·2 answers
  • A technician receives an invalid certificate error when visiting a website with port 443 enabled. Other computers on the same LA
    8·1 answer
  • Power point presentation make use of pages known as
    9·2 answers
  • HELP ME IF YOU KNOW HOW TO CODE ON PYTHON <br> ITS FOR A TEST DUE IN A FEW MINUTES
    12·1 answer
  • How many syllables does snail have
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!