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
In the SQL environment, a _____________ is a logical group of database objects – such as tables and indexes – that are related t
Paha777 [63]

Answer:Schema

Explanation: A schema is the group that contains objects of databases with views, index, triggers, tables etc features. The specific user can access schema who persist a certain username.The user is considered as the owner of the database and its element.

Schema is usually bound to have only single database.There are some schema that are already present in the system as the in-built schema .E.g.- sys, guest etc.

5 0
3 years ago
Can i have two e-mail accounts on my android
Scrat [10]
Yes, if you download an app such as gmail or yahoo mail. hope this answered your question.
5 0
3 years ago
Which is the best description of a computer virus?
MatroZZZ [7]
The best description of a computer virus is. Someone first starts out making a malicious program, then can send it to a unexpected user. After that, when the user opens the malicious program, it can do negative things on the target. The virus first starts out in the system32, then infects a random file type for example, exe files, or dlls etc. Then random errors can pop up on the computer saying "YOUR COMPUTER IS UNDER RISK! CALL THIS NUMBER NOW! 555-555-5555" and the options of the error, can direct you to a website, that can give you another virus. To get rid of a virus, you have to ignore the popups that comes onto your computer, and get a strong antivirus like avast, or avg. Then let it scan the system. After when the scan is done, it will show up the virus, and it will give you options "to delete virus or ignore it" you would hit delete. I hope this answer helped you. Let me know if you have any more questions! Thanks!
6 0
3 years ago
Read 2 more answers
Controlling inflation is the job of the __________________.
n200080 [17]
B. Federal Reserve................
8 0
3 years ago
Read 2 more answers
Can Anybody Answer This For Me ?
AlladinOne [14]

Answer:

I'm pretty sure its 3 only (c) III only gimme brainliest

3 0
3 years ago
Other questions:
  • Java - Given a String variable response that has already been declared, write some code that repeatedly reads a value from stand
    12·1 answer
  • How do i start makeing a Character in the Unreal Game Engine
    14·2 answers
  • What does this say:<br> √ans
    6·2 answers
  • A growing number of large organizations have built internal Web sites that provide opportunities for online social networking am
    7·1 answer
  • What is Mainframe computer​
    15·1 answer
  • The Healthy Nutrition Counseling Center and the Simple Solutions Software Company have recently joined forces to produce a meal
    12·1 answer
  • What does the -pwd switch do? how can you make dsadd bring up a prompt asking for the users password?
    10·1 answer
  • Assume that a file contains students' ids, full names, and their scores (Assignments grade, quizzes grade,
    5·1 answer
  • 15) Three primary activities of a program are: A) Variables, Operators, and Key Words B) Lines, Statements, and Punctuation C) I
    11·1 answer
  • Help a brotha out..................
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!