Horizontal sundial calculations: Difference between revisions
Content deleted Content added
Line 963:
6 90.500 -95.775
</pre>
=={{header|GW-BASIC}}==
{{trans|ALGOL 68}}
{{works with|PC-BASIC|any}}
<lang qbasic>
10 ' Horizontal sundial calculations
20 PRINT "Enter latitude => ";
30 INPUT LAT
40 PRINT "Enter longitude => ";
50 INPUT LNG
60 PRINT "Enter legal meridian => ";
70 INPUT REF
80 PRINT
90 LET PI = 4 * ATN(1)
100 LET SLAT = SIN(LAT * PI / 180)
110 PRINT " sine of latitude: "; USING "#.##^^^^"; SLAT
120 PRINT " diff longitude: "; USING "####.###"; LNG - REF
130 PRINT
140 PRINT "Hour, sun hour angle, dial hour line angle from 6am to 6pm"
150 FOR H% = -6 TO 6
160 LET HRA = 15 * H%
170 LET HRA = HRA - (LNG - REF): ' correct for longitude difference
180 LET HLA = ATN(SLAT * TAN(HRA * PI / 180)) * 180 / PI
190 PRINT "HR="; USING "+##"; H%;
200 PRINT "; HRA="; USING "+###.###"; HRA;
210 PRINT "; HLA="; USING "+###.###"; HLA
220 NEXT H%
230 END
</lang>
{{out}}
<pre>
Enter latitude => ? -4.95
Enter longitude => ? -150.5
Enter legal meridian => ? -150
sine of latitude: -.86E-01
diff longitude: -0.500
Hour, sun hour angle, dial hour line angle from 6am to 6pm
HR= -6; HRA= -89.500; HLA= +84.225
HR= -5; HRA= -74.500; HLA= +17.283
HR= -4; HRA= -59.500; HLA= +8.334
HR= -3; HRA= -44.500; HLA= +4.847
HR= -2; HRA= -29.500; HLA= +2.795
HR= -1; HRA= -14.500; HLA= +1.278
HR= +0; HRA= +0.500; HLA= -0.043
HR= +1; HRA= +15.500; HLA= -1.371
HR= +2; HRA= +30.500; HLA= -2.910
HR= +3; HRA= +45.500; HLA= -5.018
HR= +4; HRA= +60.500; HLA= -8.671
HR= +5; HRA= +75.500; HLA= -18.451
HR= +6; HRA= +90.500; HLA= +84.225
</pre>
=={{header|Haskell}}==
|