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
madam [21]
3 years ago
14

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.
Your program must define and call the following function. The function should return true if the input year is a leap year and false otherwise.
bool IsLeapYear(int userYear)

Computers and Technology
2 answers:
Gekata [30.6K]3 years ago
6 0

Answer:

# include <iostream>

#include<stdio.h>

using namespace std;

bool IsLeapYear(int y)

int main()

{

int y;

cout<<"Enter the Year to check Leap or Not"<<endl;

cin>>y;

IsLeapYear(int y);

getch();

}

bool IsLeapYear(int y)

{

if (y%4==0)

{

   if (y%100==0)

    {

         if (y%400==0 )

         {

          cout<"The year is leap Year";

         }

         else

         {

         cout<<" The year is not Leap Year";

         }

     }

     else

     {

     cout<<"The year is Leap Year" ;

     }

}    

else

{

cout<<"The year is not Leap Year";

}    

}

Explanation:

In this program a function has been defined named as IfLeapYear, to check that whether the entered year is leap year or not. An year taken as integer data type named as y to enter the year to check. If the year is divisible by 4 but not divisible by 100 is the leap year. If the year is divisible by 4, divisible by 100 and also divisible by 400 is the century year and is also the leap year.

To check all the statements, Nested if-else conditions has been used to check multiple requirements of the leap year.

givi [52]3 years ago
5 0

Answer:

Explanation: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")

You might be interested in
According to your course, two benefits of a cloud-based system are_ and_
vodomira [7]
Data backup and collaboration.
4 0
3 years ago
Gina is upgrading your computer with a new processor. She installs the processor into your motherboard and adds the cooling syst
Setler [38]

Answer:

Option B is Correct.

Explanation:

Thermal paste is used in the CPU motherboard to reduce the heat.

Thermal paste is a heat observing coating that is used to make the system cool when it is heated much by working for a long time.

Thermal paste is also used in heat sink in CPU and CPU passes the air in the heat sink to make the temperature normal.

Thermal paste is very useful which installing any processor otherwise which running, the temperature will be increased in the absence of the thermal paste.

It is used to maintain the empty place between the motherboard and the processor.

7 0
3 years ago
Dani is paraphrasing from a paragraph of an article for a post on her blog. Which of the following strategies is least likely to
koban [17]
I would say A. She reads the entire paragraph, then rewrites it in her own words, and then checks to make sure her version is not too similar to the text from the article.


All the other ones are a little too obvious.


Hope this helps you, baii <33

4 0
3 years ago
Read 2 more answers
How much memory can be addressed in protected mode?
tamaranim1 [39]
Access to 4 gigabytes of memory



5 0
3 years ago
A hard drive that is running slowly may not have been a0properly.
kipiarov [429]
Its outdated maybe because of time issues or over-usage<span />
6 0
2 years ago
Read 2 more answers
Other questions:
  • Consider a set of mobile computing clients in a certain town who each
    13·1 answer
  • What is the purpose of this diamond shape in a flowchart?
    8·1 answer
  • Given 3 floating-point numbers. Use a string formatting expression with conversion specifiers to output their average and their
    14·1 answer
  • Which of the given original work is protected by the copyright law
    14·2 answers
  • Why can't you test a program for run-time errors when it has compile-time (syntax) errors
    6·1 answer
  • Which of the following statements is false? People tend to shortcut security procedures because the procedures are inconvenient.
    13·1 answer
  • William found out that someone used his report on american culture without his permission. what is william a victim of?
    11·1 answer
  • What simple machine is most often used to lift the blinds on a window?
    8·2 answers
  • You want to use a terminal program to terminal into a cisco router. what protocol should i use
    8·1 answer
  • A qualifier distinguishes the set of objects at the far end of the association based on the qualifier value.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!