Skip to content

Instantly share code, notes, and snippets.

@0x416E64
Created November 19, 2016 22:31
Show Gist options
  • Save 0x416E64/34cb608120af6470cc8f3e3852f899f5 to your computer and use it in GitHub Desktop.
Save 0x416E64/34cb608120af6470cc8f3e3852f899f5 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int numOfDays(int m, int y)
{
return 0;
}
int isLeapYear(int y)
{
return 0;
}
int daysSinceBeginning( int y, int m, int d ) {
int days = d;
while( m > 1 ) {
m--;
days += numOfDays( m, y );
}
while( y > 2000 ) {
y--;
printf( "y%d\n", y);
if( isLeapYear( y ) ) days += 366;
else days += 365;
}
printf( "%d\n", days );
return days;
}
int main()
{
daysSinceBeginning(2015, 1, 1);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment