forked from ngthanhtrung23/CompetitiveProgramming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA.cob
More file actions
24 lines (22 loc) · 618 Bytes
/
A.cob
File metadata and controls
24 lines (22 loc) · 618 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
IDENTIFICATION DIVISION.
PROGRAM-ID. SOLUTION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 A PIC 9(10) VALUE ZEROES.
01 B PIC 9(10) VALUE ZEROES.
01 STR PIC X(10).
01 F PIC 9(10).
PROCEDURE DIVISION.
ACCEPT STR
MOVE STR TO A
ACCEPT STR
MOVE STR TO B
ADD A TO B
MOVE B TO STR
perform until STR(1:1) IS NOT EQUAL TO '0'
move length OF STR TO F
SUBTRACT 1 FROM F
move STR(2:F) TO STR
end-perform.
DISPLAY STR
STOP RUN.