Trending This Week:

test

Post Top Ad

Your Ad Spot

Friday, June 10, 2022

C Program to check that year is leap year or not.



C Program to check that year is leap year or not.

#include <iostream>


using namespace std;


int main() {


  int year;

  cout << "Enter Number : ";

  cin >> year;

  if (year % 4 == 0) {

    if (year % 100 == 0) {

      if (year % 400 == 0)

        cout << year << " is a leap year";

      else

        cout << year << " is not a leap year";

    } else

      cout << year << " is a leap year";

  } else

    cout << year << " is not a leap year";

  return 0;

}

No comments:

Post a Comment

Post Top Ad

Your Ad Spot