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
Pachacha [2.7K]
3 years ago
5

#A year is considered a leap year if it abides by the #following rules: # # - Every 4th year IS a leap year, EXCEPT... # - Every

100th year is NOT a leap year, EXCEPT... # - Every 400th year IS a leap year. # #This starts at year 0. For example: # # - 1993 is not a leap year because it is not a multiple of 4. # - 1996 is a leap year because it is a multiple of 4. # - 1900 is not a leap year because it is a multiple of 100, # even though it is a multiple of 4. # - 2000 is a leap year because it is a multiple of 400, # even though it is a multiple of 100. # #Write a function called is_leap_year. is_leap_year should #take one parameter: year, an integer. It should return the #boolean True if that year is a leap year, the boolean False #if it is not. #Write your function here!

Computers and Technology
1 answer:
lara [203]3 years ago
5 0

Answer:

To check if the year comes under each 100th year, lets check if the remainder when dividing with 100 is 0 or not.

Similarly check for 400th year and multiple 0f 4. The following C program describes the function.

#include<stdio.h>

#include<stdbool.h>

bool is_leap_year(int year);

void main()

{

int y;

bool b;

 

printf("Enter the year in yyyy format: e.g. 1999 \n");

scanf("%d", &y);     // taking the input year in yyyy format.

 

b= is_leap_year(y);  //calling the function and returning the output to b

if(b==true)

{

 printf("Thae given year is a leap year \n");

}

else

{

 printf("The given year is not a leap year \n");

}

}

bool is_leap_year(int year)

{

if(year%100==0)   //every 100th year

{

 if(year%400==0)   //every 400th year

 {

  return true;

 }

 else

 {

  return false;

 }

}

if(year%4==0)  //is a multiple of 4

{

 return true;

}

else

{

 return false;

}

}

Explanation:

Output is given as image

You might be interested in
Can someone explain to me how to do circuit calculations
GenaCL600 [577]

Use the following rules:

- The sum of currents that enter and exit a node (junction) is always zero. So if you have 3 wires that connect, through one flows 2A, the other 3A, then the third must deliver 5A (taking the direction into account!)


- The sum of voltages across different components should always add up. So if you have a battery of 10V with two unknown resistors, and over one of the resistors is 4V, you know the other one has the remaining 6V.


- With resistors, V=I*R must hold.

With these basic rules you should get a long way!

7 0
3 years ago
Which of these statements is true about database reports? A. A generated report will include all records in the database. B. A g
weeeeeb [17]

B. A generated report will include all records that a query fetches.

6 0
3 years ago
A(n) _______ attack attempts to make a server or network unavailable to serve legitimate users by flooding it with attack packet
malfutka [58]

Answer:

DoS or Denial of Service

Explanation:

Have a nice day! :)

3 0
2 years ago
Match each of the following terms to its function:_________
Crazy boy [7]

Answer:

I = B

II = E

III = A

IV = D

V = C

7 0
3 years ago
What is the term for the era created by the digital revolution?
Ahat [919]
Technological innovation
8 0
3 years ago
Other questions:
  • Kendall receives an email stating that a leading computer company is giving away free computers, asking her to forward the email
    15·1 answer
  • You've been asked to find the largest number in a range of numbers. Which of the following could you use to find the largest num
    8·1 answer
  • Which of the following is true of Chinese Opera: Two opera centers emerged Beijing and Yangzhou 300-400 forms of opera arose in
    10·1 answer
  • Within the sites that support disaster recovery, ___________ is a separate and fully equipped facility where the company can mov
    6·1 answer
  • What is a tax exemption (also known as a tax allowance)?
    13·1 answer
  • Hi need help on this <br> what is cyberspace
    14·1 answer
  • What is the second step when designing an algorithm?
    12·2 answers
  • A programmer wants to determine whether a score is within 10 points of a given target. For example, if the target is 50, then th
    11·1 answer
  • A program similar to mtr, ____, is available as a command-line utility in Windows operating systems.
    12·1 answer
  • Which language should you use to add functionality to web pages.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!