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
When a Python script is running as a standalone program, what will the __name__ variable be set to?
Sholpan [36]

Answer:

When a Python script is running as a standalone program, the __name__ variable will be set to __main__.

Explanation:

Python does not have main( ) function like some other programming language. So, when a command is given the interpreter to execute a python program, the code that is indented least (that is level 0) is executed first.

However, before doing that, it will define a few special variables. __name__ is one such special variable. If the source file is executed as the main program, the interpreter sets the __name__ variable to have a value “__main__”. If this file is being imported from another module, __name__ will be set to the module’s name.

5 0
3 years ago
Aubrey didnt like to use graphics or images on her slides. She preferred to use only a title for her slides and bullet-poinged t
Fed [463]

Hiya!


<u>Answer:</u>

Of the options given, your answer is A.) As long as you use it responsibly, it will enhance your slides and engage your audience.

<u>Why is this correct?</u>

While Aubrey may not enjoy using media, a visual aid is sometimes needed outside of text. Even if it's sometimes a graphic or a chart, it does wonders to  help it make sense; especially with a mixed bag of people and I'd suggest you google it yourself as well. This means B is out. Sayonara!

Secondly, there MUST be a balance between media and text. Too many images will, as Aubrey believes, have an adverse effect on the presentation. So much as a caption on your photos is good. C is tonight's big loser.

Finally, there is the split between A and D. What do we do now? Both make some lick of sense, right? Think again. Media may help entertain your audience, but that's not the point of presentations most of the time; It's to present information in both a graphical/verbal format without using a video. In fact, I'd say it's harder for a presenter to describe a photo on his own, meaning it will NOT take pressure off the presenter.


I hope my answer helped!

8 0
3 years ago
Read 2 more answers
1 Explain the difference between using a computer program and programming a computer.
Zanzabum
Well when you are using a computer program you are using a program. If you are programming a computer you are making the computer do a desired task. 
7 0
2 years ago
The house belives that works should be compensated for the loss of jobs due to automation? Describe it in against motion of the
Dima020 [189]

well they should because without a job people cant live a good life and if they took that from them then they should compensate them at least.

5 0
3 years ago
There is an interface I that has abstract class AC as its subclass. Class C inherits AC. We know that C delegates to an object o
Aloiza [94]

Answer:

are u in HS or college work

I am trying to understand

6 0
2 years ago
Other questions:
  • Carmina wants to move a paragraph to the right margin of the document she is working in. She moves her cursor to
    8·2 answers
  • Define the following term: - hue
    11·2 answers
  • Which of the following should you avoid when designing your Print resume?
    11·1 answer
  • when you create workplace documents, it is most important to ensure that they are clear, professional, and a. short. b. informal
    7·1 answer
  • Int a=10 int b=20<br> A=b<br> The new values for a and b are
    11·2 answers
  • When using the Common Internet File System (CIFS), which security model does not require a password to be set for the file share
    7·1 answer
  • How are switches indirectly involved in ARP poisoning?
    6·1 answer
  • when files on storage are scattered throughout different disks or different parts of a disk, what is it called
    10·1 answer
  • In 1981, the first digital icons were launched for users in _________, which was the first computer with a GUI operating system.
    12·1 answer
  • Full form of NCP?............
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!