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
Goryan [66]
3 years ago
11

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.

Ex: If the input is 1712, the output is:

1712 is a leap year.
Ex: If the input is 1913, the output is:

1913 is not a leap year.
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();

/* Type your code here. */
}
}
Computers and Technology
2 answers:
Bas_tet [7]3 years ago
8 0

Answer:

def is_leap_year(year):

  if(year % 400 == 0):

      return True

  elif year % 100 == 0:

      return False

  elif year%4 == 0:

      return True

  else:

      return False  

if __name__ == '__main__':

  n = int(input())

  if(is_leap_year(n)):

      print(n,"is a leap year.")

  else:

      print(n, "- not a leap year")

Explanation:

denpristay [2]3 years ago
5 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:

If a year is 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
A table is a useful way to present information that is organized into categories, or fields.
iris [78.8K]

Answer:

true

Explanation:

hope this helps!!!

6 0
3 years ago
High capacity circuits are limited by the least capable network link, which is typically the user connection. As such, it is imp
Mariana [72]
The answer is “true”
4 0
3 years ago
If the fluid level in a battery is below the separators<br> should be added but never add
geniusboy [140]
Never add tap water to your battery. ... Battery electrolyte levels should be just below the bottom of the vent well, about ½ - ¾ inch above the tops of the separators. Never let the electrolyte level to drop below the top of the plates.
7 0
3 years ago
A type of authentication that requires the user to provide something that they know, such
bagirrra123 [75]
The answer would be true
5 0
3 years ago
A(n) ________ file contains data that has been encoded as text, using one of the computer's encoding schemes.
tangare [24]

Hello there

the answer is text

hope this helps

Queen Z

8 0
2 years ago
Read 2 more answers
Other questions:
  • Define a function begins_with_line that consumes a string and returns a boolean indicating whether the string begins with a dash
    15·1 answer
  • Janet is testing the effectiveness of four different plant foods. She plants four identical seeds in four identical pots, supply
    6·2 answers
  • Amazon Web Services (AWS): Group of answer choices a) forms a majority percentage of Amazon's overall revenue. b) was introduced
    15·1 answer
  • How might writing an online journal be different than writing in a paper one ​
    15·2 answers
  • As a load is mechanically lifted, the materials ____________________.
    7·1 answer
  • What is an instruction set architecture​
    7·2 answers
  • Create a view named Top10PaidInvoices that returns three columns for each vendor: VendorName, LastInvoice (the most recent invoi
    12·1 answer
  • 6. Find the volume of the figure. Round your answers to the nearest
    11·1 answer
  • One limitation of high-level programming languages is
    10·1 answer
  • I just wanna know how many times a day y'all hit the tutor button at the bottom
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!