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
What are the uses of plotters​
PilotLPTM [1.2K]

Answer:

  • Plotters are use to produce the hard copy of schematics and other similar applications
  • They are mainly used for CAE applications.
  • They can print on a wide variety of flat materials

Hope it helps :)❤

5 0
2 years ago
Read 2 more answers
Suggest three ways in which celebrating an occasion influences food choices?
Basile [38]

Celebrating influences food in more than 1 way
6 0
2 years ago
Read 2 more answers
Which expresses 6y : 9y in its simplest form?
Gwar [14]
<span>This problem is an example of ratio and proportion. You are given 6y:9y. You are required to convert this into its simplest form. The 6y:9y is also equivalent to 6y/9y. The ‘y’ variable can be eliminated since it has the same exponent and base. You are left with 6/9. The common factor for 6 and 9 is 3 so divide each number by 3. So 6/3 is 2 and 9/3 is 3. You get 2/3. This is its simplest form.</span>
6 0
2 years ago
What attack cracks a password or encryption key by trying all possible valid combinations from a defined set of possibilities (a
ss7ja [257]

Answer:

Brute Force attack.

Explanation:

A network is a platform where end user devices like computers are connected to communicate and share resources. There are public networks and private networks.

A public network has its end devices and servers configured with a public IP address, which is routable on the internet, while private networks uses private IP addresses which can be used on the internet.

Private networks can be made accessable to public users by configuring an authentication and authorization policy, which could be one or a multi factor authentication. These requires a password and other factors to access the services of a private network.

An attacker can easily access a one factor or a password accessible user account, if the password is weak by using the process called a brute Force attack.

The brute Force attack exploits the vulnerability of weak passwords by entering possible valid combination from a defined set of possibilities.

6 0
3 years ago
CAN SOMEONE PLEASE HELP ME OUT I REALLY NEED THE ANSWER!
Lemur [1.5K]

Answer:

This will work for most languages, but this is mainly for c#. Double check what language your using before putting in this answer.

          Console.WriteLine("What grade are you in?");

           int grade = Convert.ToInt32(Console.ReadLine());

           if (grade == 9)

           {

               Console.WriteLine("Freshman");

           }

           if (grade == 10)

           {

               Console.WriteLine("Sophomore");

           }

           if (grade == 11)

           {

               Console.WriteLine("Junior");

           }

           if (grade == 12)

           {

               Console.WriteLine("Senior");

           }

           if (grade < 8)

           {

               Console.WriteLine("Not in High School");

           }

Explanation:

The first line asks what grade are you in, then when the user types in the grade it saves it in a variable. We then use that variable for the conditionals. The conditional states, whatever grade level your in, it prints your high school year title. If anything is lower than 8, it will print not in high school.

6 0
2 years ago
Other questions:
  • How do I learn coding??? ​
    5·2 answers
  • Assume the following variable definitions int a = 5, b = 12; double x = 3.4, z = 9.1. What are the values of the following expre
    7·1 answer
  • What is an accessory?
    6·1 answer
  • To write 10 lines of code on paper:
    10·1 answer
  • Optimally, the __________ guides investment decisions and decisions on how ISs will be developed, acquired, and/or implemented.
    6·1 answer
  • Malware that corrupts the target operating system in such a manner that a network defender can no longer trust the native OS is
    15·1 answer
  • An electronic braille embosser that translates text from a braille keyboard to a printer:
    10·1 answer
  • 1. Define a C++ function with the name evaluateBook. The function receives as one argument the name of the file to be processed
    13·1 answer
  • Which types of file formats are the best choice for files that may need to be edited later?
    14·1 answer
  • How many atoms of oxygen in 4 molecules of HN03​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!