forked from ngthanhtrung23/CompetitiveProgramming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathD.cob
More file actions
25 lines (19 loc) · 723 Bytes
/
D.cob
File metadata and controls
25 lines (19 loc) · 723 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
IDENTIFICATION DIVISION.
PROGRAM-ID. SOLUTION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 K PIC 9(12) VALUE ZEROES.
01 D1 PIC 9(12) VALUE ZEROES.
01 D2 PIC 9(12) VALUE ZEROES.
01 STR PIC X(100).
01 RES PIC X(100).
PROCEDURE DIVISION.
ACCEPT STR
ACCEPT K
STRING STR(7:4), STR(4:2), STR(1:2) INTO RES
MOVE FUNCTION INTEGER-OF-DATE(RES) TO D1
COMPUTE D2 = D1 + K
MOVE FUNCTION DATE-OF-INTEGER(D2) TO RES
STRING RES(7:2), '.', RES(5:2), '.', RES(1:4) INTO STR
DISPLAY STR
stop run.