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
You type. The word "weather" when you ment "whether" when will the writer or word flag this as a misspelling or a grammar proble
xxTIMURxx [149]
Most likely depends on the situation
8 0
3 years ago
: How does the founder of Wikipedia keep a tight reign on accuracy? HELP PLEZ AT LEAST A PARGRAPH PLES
natita [175]
The truth is that you do not get to just make an account and post. He keeps it steady by having a highly trained group of people go through all the information and make sure it is correct before they let it be posted. They have not, however, changed things that were posted before those people started to work.
5 0
3 years ago
In cell B20, enter a
zzz [600]

Answer:

かあなたは棚田やヌタほたややあはあやあやあさあ与田弥太は沙汰やあはあわあね、田やホワアラハやくださいヤアカやさ矢田かほあや体は白湯のやさた

Explanation:

なたさたらなやさゆなやさら

5 0
2 years ago
45 points!
sertanlavr [38]
Email and cookies need SSL. Other options do not need SSL
5 0
3 years ago
Select the correct answer.
Ierofanga [76]

The program which would help Eva convert a Lisp file into machine code by interpreting only a single line of code at a time is: A.  interpreters

Interpreters can be defined as computer software programs that are designed to translate (interpret) a programming language (code) into machine code, especially by interpreting only a single line of code at a time.

Hence, an interpreter executes the instructions that are written in a programming language (code) one after the other (instruction by instruction), before it translate (interpret) the next line of code.

On the other hand, a compiler takes the entire program (code) and interprets them.

In conclusion, an interpreter can help Eva convert a Lisp file into machine code by interpreting only a single line of code at a time.

Rea d more: brainly.com/question/21130620

5 0
2 years ago
Other questions:
  • What event in the 1970s contributed to the current
    6·2 answers
  • A _____ is a device that not only provides surge protection, but also furnishes desktop computers and network devices with batte
    7·1 answer
  • What is another name for a central processing unit? Computer Integrated circuit Microprocessor Transistor
    9·2 answers
  • Do the shape of a sign gives you a clue about the information contained on the sign
    7·1 answer
  • What should you do to organize a large amount of data??
    10·1 answer
  • I need to change the subject before they get onto me. I am only revealing info today if you are a friend.
    5·1 answer
  • Juan has performed a search on his inbox and would like to ensure the results only include those items with attachments which co
    14·2 answers
  • Match the feature to its function.
    7·1 answer
  • How you use ict today and how will you use it tomorrow
    14·1 answer
  • Differenciate between foreign key and primary key in database.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!