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
Task 5: Create the GET_CREDIT_LIMIT procedure to obtain the full name and credit limit of the customer whose ID currently is sto
lidiya [134]

The SQL statement that would create the GET_CREDIT_LIMIT procedure to obtain the full name and credit limit of the customer is:

GET_CREDIT_LIMIT

SELECT CUST_ID 125

FROM FIRST_NAME, LAST_NAME, CREDIT_LIMIT

WHERE LAST_NAME ="Smith"

<h3>What is SQL?</h3>

This is an acronym that means Structured Query Language that is used in handling data in a database.

Hence, we can see that from the attached image, there is a table that contains the details of customers and their various data such as their first and last names, credit limits, address, etc, and the  GET_CREDIT_LIMIT procedure is shown above.

Read more about SQL here:

brainly.com/question/25694408

#SPJ1

3 0
1 year ago
What are the ethical implications of online social media after someone has died?
ZanzabumX [31]
<span>Think about the things people might have wanted private, but after death they have no control.</span>
8 0
2 years ago
1. Assume that word is a variable of type String that has been assigned a value . Assume furthermore that this value always cont
s2008m [1.1K]

Answer:

1.word = "George slew the dragon"

startIndex = word.find('dr')

endIndex = startIndex + 4

drWord = word[startIndex:endIndex]

2. sentence = "Broccoli is delicious."

sentence_list = sentence.split(" ")

firstWord = sentence_list[0]

Explanation:

The above snippet is written in Python 3.

1. word is initialized to a sentence.

Then we find the the occurence of 'dr' in the sentence which is assign to startIndex

We then add 4 to the startIndex and assign it to endIndex. 4 is added because we need a length of 4

We then use string slicing method to create a substring from the startIndex to endIndex which is assigned to drWord.

2. A string is assigned to sentence. Then we split the sentence using sentence.split(" "). We split based on the spacing. The inbuilt function of split returns a list. The first element in the list is assigned to firstWord. List uses zero based index counting. So. firstWord = sentence_list[0] is use to get first element.

4 0
3 years ago
Draw a flowchart to input a number and find out whether it is divisible by 7 or not​
Over [174]

Note:

% is Modulus,

So it's taken as num mod 7, if that evaluates to 0 there is no reminder therefore divisible by 7.

7 0
2 years ago
Match the description to the step in troubleshooting.
Digiron [165]
It should go 4 5 3 2 1
5 0
3 years ago
Other questions:
  • The part of the computer that contains the brain, or central processing unit, is also known as the A. monitor. B. keyboard. C. m
    13·2 answers
  • Which is the last step in conducting a URL search?
    5·2 answers
  • Write a program in c++ to displaypascal’s triangle?
    14·1 answer
  • Question 3 of 10
    13·1 answer
  • Write a function shampoo_instructions() with parameter num_cycles. If num_cycles is less than 1, print "Too few.". If more than
    9·1 answer
  • Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 te
    13·1 answer
  • Two threads try to acquire the same resource at the same time and both are blocked. Then, they continually change their states i
    14·1 answer
  • Question is on the picture thank you
    10·1 answer
  • What types of things were often NOT captured in early photographs?
    7·1 answer
  • 2.Some artists look for ways to extend copyright for longer than the laws normally allow. Why do they do this?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!