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; therefore, both 1700 and 1800 are not leap years 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 leap year Ex: If the input is 1913, the output is: 1913 not a leap year 1 #include 2 #include 3 4 int main(void) { 5 6 7 8 9 10 11 12} int inputYear; bool isLeapYear = false; scanf("%d", &inputYear); /* Type your code here. */ return 0;
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
(Ungraded) C Language - Write a
![---
### Leap Year Determination in the Gregorian Calendar
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; therefore, both 1700 and 1800 are not leap years.
Some example leap years are 1600, 1712, and 2016.
#### Example Inputs and Outputs
- If the input is 1712, the output is:
```
1712 - leap year
```
- If the input is 1913, the output is:
```
1913 - not a leap year
```
#### Program Example
Below is an example program written in C, which takes in a year and determines whether that year is a leap year.
```c
#include <stdio.h>
#include <stdbool.h>
int main(void) {
int inputYear;
bool isLeapYear = false;
scanf("%d", &inputYear);
/* Type your code here. */
return 0;
}
```
In this program:
- `#include <stdio.h>` and `#include <stdbool.h>` are directives to include the standard input-output and boolean libraries respectively.
- `int main(void)` is the main function where the program starts execution.
- `int inputYear;` declares an integer variable `inputYear` to hold the year input.
- `bool isLeapYear = false;` initializes a boolean variable `isLeapYear` to false.
- `scanf("%d", &inputYear);` reads the input year from the user.
The actual logic to determine whether `inputYear` is a leap year should be typed where it says `/* Type your code here. */`.
---
This transcription includes all necessary details for understanding the leap year concept and a basic example of how to implement a leap year check programmatically.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F1f88de0d-cdb6-4ad3-b649-34d4011e29a7%2F532aba71-2790-4e8e-aad0-d87aa2e3f151%2Frfwe1x_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)