       IDENTIFICATION DIVISION.
       PROGRAM-ID. NSG-CALCULATOR.
       AUTHOR. Bruno Lima.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 UNFORMATTED.
        02 CREDITS             PIC 9(2)            VALUE 0.
        02 GRADES              PIC 9(2)V9(2)       VALUE 0.
       01 FORMATTED.
        02 FINAL-GRADES        PIC 9(2).9(2)       VALUE 0.
        02 NSG                 PIC 9(1).9(2)       VALUE 0.
       01 TEMPORARY
        02 TEMPORAL1           PIC 9(1)            VALUE 0.
        02 TEMPORAL2           PIC 9(2)V9(1)       VALUE 0.

       SCREEN SECTION.
       01 INPUT-SCREEN
        BLANK SCREEN, AUTO, REQUIRED,
        FOREGROUND-COLOR IS 7,
        BACKGROUND-COLOR IS 1.
        02 LINE 03 COLUMN 05 VALUE 'CREDITOS:'.
        02 LINE 03 COLUMN 11 PIC 9(1) TO TEMPORAL1.
        02 LINE 05 COLUMN 05 VALUE 'NOTA:'.
        02 LINE 05 COLUMN 12 PIC 9(1).9(1) TO TEMPORAL2.
        02 LINE 08 COLUMN 05 VALUE 'TOTAL DE CREDITOS:'.
        02 LINE 08 COLUMN 18 PIC Z9(1) FROM CREDITS.
        02 LINE 10 COLUMN 05 VALUE 'NOTA TOTAL:'.
        02 LINE 10 COLUMN 19 PIC 9(2).9(2) FROM FINAL-GRADES.
        02 LINE 12 COLUMN 05 VALUE 'NSG: '.
        02 LINE 12 COLUMN 11 PIC 9(1).9(2) FROM NSG.

       PROCEDURE DIVISION.
       MAIN-PARA.
        PERFORM LOOP-PARA UNTIL 1 NOT = 1.
        STOP RUN.

       LOOP-PARA.
        DISPLAY INPUT-SCREEN.
        ACCEPT INPUT-SCREEN.
        ADD TEMPORAL1 TO CREDITS.
        MULTIPLY TEMPORAL1 BY TEMPORAL2.
        ADD TEMPORAL2 TO GRADES.
        MOVE GRADES TO FINAL-GRADES.
        DIVIDE CREDITS INTO GRADES GIVING NSG.
