Answer to Question #280657 in C for Tharu

Question #280657

Requirements:

(1) Please enter the value of a year through the keyboard.

(2) Please program to determine whether the entered year is a leap year.

(3) The conditions for a leap year are: divisible by 4 but not divisible by 100; or divisible by 400.


1
Expert's answer
2021-12-20T10:00:21-0500
#include <iostream>
using namespace std;


int main()
{
    int year;
    
    cout<<"Enter the Year: ";
    cin>>year;
    
    if ((year % 4 == 0) and (year % 100 != 0) or (year % 400 == 0))
    {
        cout<<"It is a Leap Year";
    }
    else
    {
        cout<<"It is not a Leap Year";
    }
    
    
    
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS