(C PROGRAMMING ONLY) 1. Leap Year Detector by CodeChum Admin Let’s try to find out whether a year has 365 or 366 days. To do this, we need to create a leap year detector!   Conditions for a leap year: 1.) year must be divisible by 4 and not divisible by 100 2.) If year is divisible by 100, it must be divisible by 400 for it to be a leap year.   Instructions: You are provided with the isLeapYear() function which is already declared and defined for you. Your task is to ask the user for a year and then call the isLeapYear function to check whether the year is a leap year or not. Input 1. Year to be checked Output If a certain year is a leap year, print " is a leap year" Otherwise, print " is not a leap year" Enter year: 2020 2020 is a leap year

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

(C PROGRAMMING ONLY)

1. Leap Year Detector
by CodeChum Admin

Let’s try to find out whether a year has 365 or 366 days. To do this, we need to create a leap year detector!

 

Conditions for a leap year:

1.) year must be divisible by 4 and not divisible by 100

2.) If year is divisible by 100, it must be divisible by 400 for it to be a leap year.

 

Instructions:

You are provided with the isLeapYear() function which is already declared and defined for you.
Your task is to ask the user for a year and then call the isLeapYear function to check whether the year is a leap year or not.
Input

1. Year to be checked

Output

If a certain year is a leap year, print "<INSERT_YEAR_HERE> is a leap year"
Otherwise, print "<INSERT_YEAR_HERE> is not a leap year"

Enter year: 2020
2020 is a leap year

Input
main.c
+ c
1. Year to be checked
1 #include<stdio.h>
int isleapYear(int);
Output
int main(void) {
// TODO: Write your code here
If a certain year is a leap year, print
<INSERT_YEAR_HERE> is a leap year"
Otherwise, print "
return 0;
<INSERT_YEAR_HERE> is not a leap
9 }
year"
10
11 - int isleapYear(int n) {
if(
(n % 4
(n % 100
) {
return 1;
}
0 && n % 100 != 0) ||
0 && n % 400
Enter year: 2020
13
2020 is a leap year
14
15 -
16
17
18
19
return 0;
1234 567090123456789
H H 1 111 111 H
Transcribed Image Text:Input main.c + c 1. Year to be checked 1 #include<stdio.h> int isleapYear(int); Output int main(void) { // TODO: Write your code here If a certain year is a leap year, print <INSERT_YEAR_HERE> is a leap year" Otherwise, print " return 0; <INSERT_YEAR_HERE> is not a leap 9 } year" 10 11 - int isleapYear(int n) { if( (n % 4 (n % 100 ) { return 1; } 0 && n % 100 != 0) || 0 && n % 400 Enter year: 2020 13 2020 is a leap year 14 15 - 16 17 18 19 return 0; 1234 567090123456789 H H 1 111 111 H
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education