(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

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter8: Advanced Method Concepts
Section: Chapter Questions
Problem 8RQ
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,