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
Finding values in an array
hjlf

Answer:

The following code completes the program

for (i = 0; i < userValues.length; i++) {

     if(userValues[i] == matchValue){

         nuMatches++;

     }  }

 System.out.println(nuMatches);

Explanation:

<em>The question is poorly formatted. So, I correct the poorly formatted program segment and I complete the missing part of the program.</em>

<em>See attachment for complete program.</em>

The explanation is as follows:

This iterates through the array

for (i = 0; i < u s e r V a l u e s. length; i++) {

This checks if the current array element is the same as the match value

     if(userValues[i] == matchValue){

If yes, the number of matches is increased by 1

         nuMatches++;

     }  }

This prints the number of matches

 System.out.println(nuMatches);

Download txt
8 0
3 years ago
Assume the existence of a Building class with a constructor that accepts two parameters: a reference to an Address object repres
kolbaska11 [484]

Answer:

public ApartmentBuilding (Address addr, int sqFoo, int totUn) {

  super(addr, sqFoo);

  this. totalUnits = totUn;

}

Explanation:

To pass up parameters from a subclass constructor to a superclass constructor you just need to define a parameter name in the subclass constructor (in this case addr and sqFoo, but it can be anything you like) and then use the keyword super.

The keyword super acts exactly the same as the constructor of the superclass, however that may be defined.

And for the rest of the parameters (E.G. the ones of the sub class) you just treat them as a regular constructor.

8 0
3 years ago
What is a set of illustrations displayed in a specific sequence to pre-visualize what your mobile app looks like and how it work
sveta [45]

Answer:

'Storyboarding' is the correct answer for the above question.

Explanation:

The mobile pre-visualization is a technique in which mobile phones are get shown about the use of them. The Storyboarding app will be helpful for this. It is an app that is used to display the work and use of mobile phones. It is also used when a student wants to write something creative.

The above question also states the same concept which is described above so the answer is Storyboarding for this question.

6 0
3 years ago
A poem for coduction
Nataly_w [17]
I don't know if you want a poem about conduction but if so here ya go

no matter how the heat
different temperatures meet
hot to cold how it's done
4 0
4 years ago
Read 2 more answers
It is a part of webpage that contains the logo ang branding of the web page​
Novay_Z [31]
The answer is Header/Banner
6 0
3 years ago
Other questions:
  • Why is Bot_Seth Trash at video games?
    13·2 answers
  • One of the disadvantages of Audacity is that it has limited technical support since it is a free program.     true or false
    11·2 answers
  • Read the paragraph.
    12·2 answers
  • If a secret key is to be used as a _________ for conventional encryption a single number must be generated.
    13·1 answer
  • Which of these scenarios depicts unethical workplace practice by an employee?
    7·2 answers
  • Physical activity such as sports or even a brisk walk can help reduce
    7·2 answers
  • What is the name given to the amount that a particular camera’s lens opens?
    12·1 answer
  • You and your project team have been asked to generate a solution to a problem. The problem is not complicated, and you are sure
    6·1 answer
  • A garments manufacturing company buys various types of natural and synthetic materials to produce clothes. Which material is a s
    6·2 answers
  • have you ever had to adjust your communicatio style to egage a customer or roommate? what was the situation and outcome?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!