Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

leap year algorithm

def isLeapYear (year):
    if ((year % 4 == 0) and (year % 100 != 0)) or (year % 400 == 0):
		true
    else:
    	false
Comment

leap year algorithm

if year % 4 == 0:
  if year % 100 == 0:
    if year % 400 == 0:
      print("leap year")
    else:
      print("not a leap year")
  else:
    print("leap year")
else:
  print("not a leap year")
Comment

Leap year program

#include <stdio.h>

int main() {
   int year;
   year = 2016;

   if (((year % 4 == 0) && (year % 100!= 0)) || (year%400 == 0))
      printf("%d is a leap year", year);
   else
      printf("%d is not a leap year", year);

   return 0;
}
Comment

PREVIOUS NEXT
Code Example
Python :: how to add a list to dataframe in python 
Python :: random forrest plotting feature importance function 
Python :: python writelines newline 
Python :: how to replace a row value in pyspark dataframe 
Python :: python every other including first 
Python :: get all files within multiple directories python 
Python :: ERROR: Failed building wheel for python-ldap 
Python :: python create and show screenshot 
Python :: xaxis matplotlib 
Python :: drop columns pyspark 
Python :: switching versions of python 
Python :: spacy matcher syntax 
Python :: prime number generator python 
Python :: pyqt expressions 
Python :: python create 2d array deep copy 
Python :: how to know if the numbers is par in python 
Python :: python install gimp 
Python :: Static Assets in Django 
Python :: how to construct simple timedelta in python 
Python :: pandas casting into integer 
Python :: matplotlib axes labels 
Python :: how to read a pkl file in python 
Python :: debugar python 
Python :: python faker 
Python :: forbidden (csrf cookie not set.) django rest framework 
Python :: write json to file python 
Python :: plot bounds python 
Python :: Python find inverse of matrix 
Python :: plt normalized histogram 
Python :: how to log ip addresses in django 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =