Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

leap year, find leap year, js leap year

const isLeapYarrr = year => (year % 100 === 0) ? (year % 400 === 0) : (year % 4 === 0);
Comment

leap year

y = int(input())
if (y % 400 == 0) or (y % 100 != 0 and y %4 == 0):
    print(y,"is leap year.")
else:
    print(y,"isn't leap year.")
Comment

how to find leap year

  public static void main(String[] args) {
        int year = 2005;

        if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))){
            System.out.println(year+" leap year");
        }else {
            System.out.println(year+" not a leap year");
        }
    }
Comment

leap year

// works in C, C++, C#, Java, JavaScript, and other C-like languages

// optimal technique
if (((year & 3) == 0 && ((year % 25) != 0) || (year & 15) == 0)) {
  // leap year
}

// classic technique
if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) {
	// leap year
}
Comment

Check if a year is leap year

#include<iostream>
using namespace std;
int main() {
   int year = 2016;
   if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
   cout<<year<<" is a leap year";
   else
   cout<<year<<" is not a leap year";
   return 0;
}
Comment

how can you know if a year is a leap year

leapYear = int(input("Input a Year "))

if leapYear %4 == 0:
    print("Its a leap year")
else:
    print ("Its a normal year")
Comment

Code to check Check whether a year is leap year or not

<?php
    $year = 2022;
    if($year % 4 == 0) {
      echo $year." is a leap year";
    }
    else {
      echo $year." is a not leap year";
    }
  ?>
Comment

check leap year

def is_leap_year(year):
        """This functon returns True if year is a leap year, returns False otherwise"""
        if year % 4 == 0:
                return True
        return False
Comment

PREVIOUS NEXT
Code Example
Python :: bitwise xor in python 
Python :: Accessing elements from a Python Nested Dictionary 
Python :: parse_dates 
Python :: find location of max value in python list 
Python :: multiple line comments 
Python :: qr decomposition python 
Python :: how to make a random number generator in python 
Python :: FileSystemStorage django 
Python :: can list hold different data types in python 
Python :: Python difference between filter and map 
Python :: python file get text by regular expression 
Python :: how to get django 
Python :: parallel iteration python 
Python :: python reverse a list 
Python :: how to create a User and User profile in django rest framework 
Python :: multiple line string 
Python :: project euler problem 11 python 
Python :: python Using for loop and list comprehension 
Python :: dataframe.fillna 
Python :: logging store info to different files 
Python :: qr code detector 
Python :: Redirect the Python Script Output to File 
Python :: python message 
Python :: print in python 
Python :: tree in python 
Python :: virtual environment python 
Python :: pandas use dict to transform entries 
Python :: pytest fixture 
Python :: Math Module cos() Function in python 
Python :: determine how 2 string si equal py 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =