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
balandron [24]
3 years ago
9

6.31 LAB: Leap year - functions A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer

to rotate around the sun. To account 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:
Computers and Technology
2 answers:
Gnesinka [82]3 years ago
7 0

Answer:

The code is given below in C with appropriate comments

Explanation:

#include <stdio.h>

#include <stdbool.h>

bool ISLeapYear(int userYear)

{

  // If a year is multiple of 400,

  // then it is a leap year

  if (userYear % 400 == 0)

      return true;

  // Else If a year is multiple of 100,

  // then it is not a leap year

  if (userYear % 100 == 0)

      return false;

  // Else If a year is multiple of 4,

  // then it is a leap year

  if (userYear % 4 == 0)

      return true;

  return false;

}

int main(void) {

  int year;

  printf("Enter year : ");

  scanf("%d",&year);

  if(ISLeapYear(year)){

      printf("%d is a leap year.",year);

  }else{

      printf("%d is not a leap year.",year);

  }

  return 0;

satela [25.4K]3 years ago
4 0

Answer:

#include <iostream>

using namespace std;

int main()

{

   int detect_year;

   cout << "Enter a year to find whether its leap year or not: ";

   cin >> detect_year;

   if (detect_year % 4 == 0)

   {

       if (detect_year % 100 == 0)

       {

           if (detect_year % 400 == 0)

               cout << "The year you entered "<< detect_year << " is a leap year.";

           else

               cout << "The year you entered "<<detect_year<< " is not a leap year.";

       }

       else

           cout << "The year you entered "<< detect_year << " is a leap year.";

   }

   else

       cout << "The year you entered "<<detect_year<<" is not a leap year.";

   return 0;

}

Explanation:

first make a variable named as detect_year of time integer. The using cin ask the user to enter any year to find out whether its leap year or not. Once the user has entered the year the value is stored in detect_year variable. After the divide the year by 4 if the remainder is not zero then it is not a leap year. If it is divisible by 4 which means the remainder is zero the divide the year by 100. If the remainder is not zero means it is not divisible by 100 then its a leap year. If it is divisible by 100 then check whether the year is divisible by 400 if yes then it is leap year other wise it is not.

You might be interested in
A) the Operating system is said to provide security. Explain what this means and give an example of a security feature.
Rzqust [24]

It means that thw operating system is up to date with all the lastest protection systems like an anti virus. An example is that the operating system has a built in ransomware protection system ib place.

Hope this help please give the brainliest award

3 0
3 years ago
In the borders and shading dialog box where would you look to see if your border will have two sides
arlik [135]
On the preview box? I think. 
6 0
3 years ago
Read 2 more answers
Select the correct answer from each drop-down menu. What skills should Tara hone to get a job in testing? Tara is a recent compu
Karo-lina-s [1.5K]
What’re the choices?
6 0
3 years ago
This Is My Humor 0w0
son4ous [18]

Answer:

yes

Explanation:

OwO

6 0
3 years ago
An object completes one round of circle of radius 7m in 20 sec. Distance travelled after 10 sec is? ​
Ivanshal [37]

Answer:

distance \: travelled \:  = 2\pi \\  \\ 44cm \:  \:  \:  \:  \\ speed \:  =  \frac{44}{2.2}  \ \\ distance \: travelled \: in \: los = 10 \times 2.2 = 22cm \\  \\ total \: distance = 44 + 22 = 66metres

5 0
3 years ago
Other questions:
  • An example of an email client is:<br> A.)Yahoo<br> B.)Gmail<br> C.)Outlook<br> D.)All of the Above
    9·1 answer
  • The internet is a worldwide assembly of computer
    11·1 answer
  • Which of the following is real job title on the interactive media career pathway?
    12·2 answers
  • Write a program that produces the following output:
    12·1 answer
  • A _________________________ can use SOAP headers to carry meta information in its messages. A. Web service B. REST Service C. Co
    14·1 answer
  • When Russ opened a website on his browser, he saw an error that the site was not compatible with the browser version he was runn
    9·1 answer
  • What option do you use to view your presentation?
    15·1 answer
  • Which of these is a valid use of the Reply All feature?
    11·1 answer
  • The following SQL is which type of join? SELECT CUSTOMER_T. CUSTOMER_ID, ORDER_T. CUSTOMER_ID, NAME, ORDER_ID FROM CUSTOMER_T,OR
    15·1 answer
  • You suspect that a bad video driver is causing a user's system to randomly crash and reboot. Where would you go to identify and
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!