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
Which of the following is not a use of a hash function
soldi70 [24.7K]

Answer:

the answer would be there

Explanation:

7 0
3 years ago
Annalise received financial aid offers from two universities. Financial Analysis for Option A Costs per Year Financial Aid Packa
lara31 [8.8K]

Answer:

Option S will save her $15500

Explanation:

Room and board, someone is provided a sum of money in return for labor. The government does not ask for this money to be returned. This is earned by the student. Also, work-study is being given to the student, the fund in return of certainly part-time employment job which he/she does in free time. And hence it is clear from the above study that, A will save $15500, and hence this is the right answer as others are taken by the universities. And also B is saving $13000, and this is not an option given.

7 0
3 years ago
Read 2 more answers
Who tryna play among us
harkovskaia [24]

Answer:

I'm doing a digital media test right now

8 0
3 years ago
Read 2 more answers
An auxiliary view is always projected from the view that shows the inclined surface as a(n) _____.
ValentinkaMS [17]
Auxiliary section i think
8 0
3 years ago
True / False<br> Generally, more orthogonal instruction sets are considered less elegant.
Cerrena [4.2K]

Answer: True

Explanation:Orthogonal instruction set is the set of instruction that can use can use all addressing mode. They have independent working and so instruction can use any register the prefer and this leads to overlapping in instruction and complexity.

When RISC architecture got introduced ,it got more preference due to reduced instruction and less complexity as compared to orthogonal instruction.So it not considered elegant to have more orthogonal instruction.

6 0
3 years ago
Other questions:
  • Write a program using integers user_num and x as input, and output user_num divided by x three times. Ex: If the input is: 2000
    15·1 answer
  • A(n) _____ can be used to reveal a competitor’s program code, which can then be used to develop a new program that either duplic
    9·1 answer
  • How do you optimize a website using JavaScript?
    10·1 answer
  • Write a statement that compares the values of score1 and score2 and takes the following actions. When score1 exceeds score2, the
    7·1 answer
  • What is computer software
    8·2 answers
  • When operating a forklift, what should you do to ensure a clear view and proper balance when traveling with a load?
    6·2 answers
  • A representation of something by using a description, summary or image.
    7·1 answer
  • ¿Cuál es la diferencia entre una plataforma educativa y una tutoría?
    7·1 answer
  • You have learned a lot about the types of careers that are involved with building a playground. Create two job descriptions of p
    7·2 answers
  • NEED HELP ASAP!!!
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!