forked from alura-cursos/cursoopencobol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathperform-varing.cbl
50 lines (42 loc) · 1.52 KB
/
perform-varing.cbl
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
IDENTIFICATION DIVISION.
PROGRAM-ID. PRGCOB16.
******************************************************
*** AREA DE COMENTARIOS - REMARKS
*** OBJETIVO DO PROGRAMA = PERFORM COM REPETICOES FINITAS
*** USANDO VARYING
*** AUTOR: IVAN
*** DATA : XX/XX/20XX
******************************************************
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
DECIMAL-POINT IS COMMA.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 WRK-NUMERO PIC 9(02) VALUE ZEROS.
77 WRK-CONTADOR PIC 9(02) VALUE ZEROS.
77 WRK-RESUL PIC 9(03) VALUE ZEROS.
77 WRK-CONTA PIC 99 VALUE ZEROS.
PROCEDURE DIVISION.
0001-PRINCIPAL.
PERFORM 0100-INICIALIZAR
IF WRK-NUMERO GREATER 0
PERFORM 0200-PROCESSAR
PERFORM 0300-FINALIZAR
END-IF
STOP RUN
.
0100-INICIALIZAR.
DISPLAY 'DIGITE O NUMERO..... : '
ACCEPT WRK-NUMERO
.
0200-PROCESSAR.
PERFORM VARYING WRK-CONTA FROM 1 BY 1 UNTIL WRK-CONTADOR > 10
COMPUTE WRK-RESUL = WRK-NUMERO * WRK-CONTADOR
DISPLAY WRK-NUMERO ' X ' WRK-CONTADOR ' = ' WRK-RESUL
END-PERFORM
.
0300-FINALIZAR.
DISPLAY '--------- SAIDA DE DADOS ------------'
DISPLAY ' FIM DE PROCESSAMENTO '
.