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.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section: Chapter Questions
Problem 5PP
icon
Related questions
Question

helppp meee 

Instructions:

  1. You are provided with the isLeapYear() function which is already declared and defined for you.
  2. 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 should be like this:

Enter year: 2020
2020 is a leap year
note: 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"
 
 
MY CODE: (IN C LANGUAGE PLEASE)

#include<stdio.h>

int isLeapYear(int);

int main(void) {
    // TODO: Write your code here

    return 0;
}

int isLeapYear(int n) {
    if(
        (n % 4 == 0 && n % 100 != 0) || 
        (n % 100 == 0 && n % 400 == 0)
    ) {
        return 1;
    }

    return 0;
}

Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Types of Function
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
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning