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
Bakit mahalaga na marunong tayong gumamit ng makina?
jeka94

Answer:

para mabilis ang gawa

Explanation:

hope it helps

5 0
3 years ago
Write a program that prints the question " Do youwant to continue? " and reads a user input. if the userinput is " Y ", " OK", o
Nataly_w [17]

Answer:

#include <bits/stdc++.h>

using namespace std;

int main() {

   string in;//string in for taking input...

   cout<<"Do you want to continue ?"<<endl;

   getline(cin,in);//taking input from the user...

   if(in=="y"||in=="Y"||in=="yes"||in=="OK"||in=="Why not?")//conditions..

   cout<<"OK"<<endl;

   else if(in=="No")

   cout<<"terminating"<<endl;

   else

   cout<<"Bad input"<<endl;

return 0;

}

Explanation:

I have taken a string in.

Then taking input from user.

Checking the conditions using if else if ladder.

7 0
3 years ago
What is not an example of a job skill
ikadub [295]

Being dishonest, irresponsible and unpunctual.Answer:

Explanation:

8 0
2 years ago
Read 2 more answers
Marx and engels identified two social classes: the ______ who possess the means of production and ______ who must do all the wor
Morgarella [4.7K]

Marx and Engels identified two social classes: the exploiters who possess the means of production and exploited  who must do all the work.

<h3>What is a Social class?</h3>

A social class is known to be a kind of a grouping of people and it is one that is made where people are said to be shared into a set of hierarchical social stages  or groups.

Note that the most common are the upper, middle and lower classes. Membership in a social class is seen to be based on  or dependent on education, wealth, occupation, and others.

Hence, Marx and Engels identified two social classes: the exploiterswho possess the means of production and exploited  who must do all the work.

Learn more about social classes from

brainly.com/question/1065123

#SPJ1

8 0
2 years ago
Which of the following are advantages of using meaningful names for variables when writing a program? Select two answers.
Colt1911 [192]

Answer:

The answer is 2 and 4, please give brainliest award.

8 0
3 years ago
Other questions:
  • Create a new Die object. (Refer to Die.html for documentation.)Create a loop that will iterate at least 100 times. In the loop b
    11·1 answer
  • GoInternet, Inc., is an Internet-access service provider that is being forced to manage numerous unwanted e-mail messages from a
    10·1 answer
  • You are an interior decorator, confronted with a dark living room. To lighten the room up, you have n candles and want to build
    12·1 answer
  • Producers must understand the marginal benefit of making an additional unit which shows the ...
    5·2 answers
  • Role-playing, action, educational, and simulations are examples of computer and video game _____. Windows and Apple offer_____ ,
    13·1 answer
  • Which of the following illustrates an example of a Boolean data type?
    15·1 answer
  • Two technicians are discussing the lower-end operation of an engine. Technician A says that power loads result from the expansio
    13·1 answer
  • This is using python.
    5·2 answers
  • 10010 - 1011 binary subtraction​
    5·1 answer
  • Identify why research and a clearly written problem statement are important. Select all that apply. They result in a clear and c
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!