home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
PROG_C
/
SNPD9404.ZIP
/
MOON_AGE.C
< prev
next >
Wrap
Text File
|
1994-04-03
|
638b
|
21 lines
.I 3 2
** Returns 0 for new moon, 15 for full moon,
** 29 for the day before new, and so forth.
.D 4 2
.I 16 3
28, 9, 20, 1, 12, 23, 4, 15, 26, 7};
static short int offsets[] =
{-1, 1, 0, 1, 2, 3, 4, 5, 7, 7, 9, 9};
.D 17 3
.I 22 2
return ((ages[(year + 1) % 19] + ((day + offsets[month-1]) % 30) +
(year < 1900)) % 30);
.D 23 35
.I 75 3
static char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
.I 91 1
printf("Moon phase on %d %s %d is %s\n", day, months[month - 1], year,
.D 92 1