Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98256257
sun.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jan 11, 12:35
Size
934 B
Mime Type
text/x-c
Expires
Mon, Jan 13, 12:35 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23545533
Attached To
R232 fabrepos2
sun.c
View Options
#include <stdio.h>
#include <math.h>
int months[]={0, 31, 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31};
char weekdays[7][15]={"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"};
/* this program calculates the latidude
where polar day begins/ends */
void main()
{
int day=24, month=6, weekday=2;
double angle=0;
double latitude;
do
{
latitude=atan(tan((23+27.0/60)*M_PI/180)*cos(angle))*180/M_PI;
latitude=(latitude>0)? 90-latitude : -90-latitude;
printf("%2d.%02d %12s : %d %02d'\n", day, month,
weekdays[weekday], (int)latitude,
(int)fabs((latitude-(int)latitude)*60));
if (weekday==0)
printf("\n");
angle+=2*M_PI/365;
day++;
if (day>months[month])
{
day=1;
month++;
if (month>12)
month=1;
}
if (++weekday>6)
weekday=0;
} while (month!=1);
}
Event Timeline
Log In to Comment