05-20-2019, 12:52 PM
Days Since January 1
Calculate the number of days since January 1. For more information, please see: http://edspi31415.blogspot.com/2019/03/t...-days.html
Input:
R1: day
R2: month
R3: 0 if we are working in a non-leap year, 1 if we are working in a leap year
Output:
R4: number of days since January 1
Program:
Example 1:
1/1/2019 - 5/7/2019 (non-leap year)
R1: 7, R2: 5, R3: 0
Result: R4 = 126
Example 2:
1/1/2020 - 11/14/2020 (leap year)
R1: 14, R2: 11, R3: 1
Result: R4 = 318
Calculate the number of days since January 1. For more information, please see: http://edspi31415.blogspot.com/2019/03/t...-days.html
Input:
R1: day
R2: month
R3: 0 if we are working in a non-leap year, 1 if we are working in a leap year
Output:
R4: number of days since January 1
Program:
Code:
01 LBL A: 61,41,A
02 RCL 1: 22,1
03 STO 4: 21, 4
04 3: 3
05 5: 5
06 STO - 4: 21,65,4
07 RCL 2: 22,2
08 INPUT: 31
09 2: 2
10 x ≤ y?: 61,42
11 GTO 2: 51,41,2
12 RCL 2: 22,2
13 *: 55
14 3: 3
15 0: 0
16 . : 73
17 6: 6
18 +: 75
19 1: 1
20 . : 73
21 6: 6
22 =: 74
23 IP: 51, 45
24 STO + 4: 21,75,4
25 RCL 3: 22,3
26 STO + 4: 21,75,4
27 RCL 4: 22,4
28 RTN: 61, 26
29 LBL 2: 61,41,2
30 RCL 2: 22,2
31 *: 55
32 3: 3
33 0: 0
34 . : 73
35 6: 6
36 +: 75
37 3: 3
38 6: 6
39 8: 8
40: . : 73
41 8: 8
42 =: 74
43 IP: 51,45
44 STO + 4: 21,75,4
45 3: 3
46 6: 6
47 5: 5
48 STO - 4: 21,65,4
49 RCL 4: 22,4
50 RTN: 61,26
Example 1:
1/1/2019 - 5/7/2019 (non-leap year)
R1: 7, R2: 5, R3: 0
Result: R4 = 126
Example 2:
1/1/2020 - 11/14/2020 (leap year)
R1: 14, R2: 11, R3: 1
Result: R4 = 318