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
Pls answer will give brainlest dont answer if you dont know Upload your 300-word essay containing the following: the definition
Rainbow [258]

Answer: oh hello human :) also PLEASE DONT KILL ME I’m answering this because the question was already answered already on another post

6 0
2 years ago
Which AWS service is a managed service that makes it easy to set up, operate, and scale a relational database in the cloud?​
vaieri [72.5K]

Answer:

I use Google cloud free tier for my Minecraft server

4 0
3 years ago
a solid state drive is a removable flash memory device that you insert and remove from a slot in a computer, mobile device, or c
yulyashka [42]
It is true, Because all the the drives or memories which doesn't have a plates spinning like hard disk are called solid state drives.
4 0
2 years ago
You should always buy the biggest camera bag that you can find for extra equipment.
Akimi4 [234]

Answer:

true

Explanation:

7 0
2 years ago
Read 2 more answers
A list is sorted by selecting the largest element in the list and swapping it with the last one. This technique is called ______
ratelena [41]
Selection sort is the answer
4 0
2 years ago
Other questions:
  • This is tech question related to mobile and PC.
    6·1 answer
  • You want to place a video from the internet to your desktop. what process do you use?
    15·1 answer
  • Select all that apply.
    8·2 answers
  • A(n) monitoring vulnerability scanner is one that listens in on the network and determines vulnerable versions of both server an
    7·1 answer
  • Which tables and fields would you access to determine which book titles have been purchased by a customer and when the order shi
    15·1 answer
  • The piece of hardware that contains the circuitry that processes the information coming in to the computer and tells the other h
    8·1 answer
  • How do I logout of Brainly on mobile? When I went to settings, it had the option to log out but it was grayed out.
    14·1 answer
  • Where can you find your EFC
    8·2 answers
  • Large and fast disks should be used for as doing so will ensure work is done as quickly as possible?
    8·1 answer
  • In what way, if any, is the impact of a given risk affected by the timing of a project?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!