Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,29 +0,0 @@
|
|||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. leap-year.
|
||||
|
||||
DATA DIVISION.
|
||||
WORKING-STORAGE SECTION.
|
||||
01 examples VALUE "19001994199619972000".
|
||||
03 year PIC 9(4) OCCURS 5 TIMES
|
||||
INDEXED BY year-index.
|
||||
|
||||
01 remainders.
|
||||
03 400-rem PIC 9(4).
|
||||
03 100-rem PIC 9(4).
|
||||
03 4-rem PIC 9(4).
|
||||
|
||||
PROCEDURE DIVISION.
|
||||
PERFORM VARYING year-index FROM 1 BY 1 UNTIL 5 < year-index
|
||||
MOVE FUNCTION MOD(year (year-index), 400) TO 400-rem
|
||||
MOVE FUNCTION MOD(year (year-index), 100) TO 100-rem
|
||||
MOVE FUNCTION MOD(year (year-index), 4) TO 4-rem
|
||||
|
||||
IF 400-rem = 0 OR ((100-rem NOT = 0) AND 4-rem = 0)
|
||||
DISPLAY year (year-index) " is a leap year."
|
||||
ELSE
|
||||
DISPLAY year (year-index) " is not a leap year."
|
||||
END-IF
|
||||
END-PERFORM
|
||||
|
||||
GOBACK
|
||||
.
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
program-id. leap-yr.
|
||||
*> Given a year, where 1601 <= year <= 9999
|
||||
*> Determine if the year is a leap year
|
||||
data division.
|
||||
working-storage section.
|
||||
1 input-year pic 9999.
|
||||
1 binary.
|
||||
2 int-date pic 9(8).
|
||||
2 cal-mo-day pic 9(4).
|
||||
procedure division.
|
||||
display "Enter calendar year (1601 thru 9999): "
|
||||
with no advancing
|
||||
accept input-year
|
||||
if input-year >= 1601 and <= 9999
|
||||
then
|
||||
*> if the 60th day of a year is Feb 29
|
||||
*> then the year is a leap year
|
||||
compute int-date = function integer-of-day
|
||||
( input-year * 1000 + 60 )
|
||||
compute cal-mo-day = function mod (
|
||||
(function date-of-integer ( int-date )) 10000 )
|
||||
display "Year " input-year space with no advancing
|
||||
if cal-mo-day = 229
|
||||
display "is a leap year"
|
||||
else
|
||||
display "is NOT a leap year"
|
||||
end-if
|
||||
else
|
||||
display "Input date is not within range"
|
||||
end-if
|
||||
stop run
|
||||
.
|
||||
end program leap-yr.
|
||||
Loading…
Add table
Add a link
Reference in a new issue