Thursday, 10 March 2011

*COBOL program to generate series which are divisible by 5 but not by 4


       IDENTIFICATION DIVISION.
       PROGRAM-ID. NUM.
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       77 N PIC 9(3).
       77 I PIC 9(3) VALUE 10.
       77 R PIC 9(3).
       77 Q PIC 9(3).
       PROCEDURE DIVISION.
       READ-PARA.
           DISPLAY "Enter the limit"
           ACCEPT N.
           IF N < 10
           DISPLAY "NO NUMBER DIVISIBLE BY 5 "
           GO TO EXIT-PARA.
           DISPLAY "EVEN NUMBERS DIVISIBLE BY 5".
       COMPUTE-PARA.
           IF I > N GO TO EXIT-PARA.
           DIVIDE I BY 4 GIVING Q REMAINDER R
           IF R NOT = 0
           DISPLAY I.
           ADD 10 TO I
           GO TO COMPUTE-PARA.
       EXIT-PARA.
       STOP-RUN.

No comments:

Post a Comment

Get CSV Values in SQL

Query: DECLARE @CSVValue NVARCHAR(50)='100,101,102'                   DECLARE @eachValue NUMERIC(9,0)   while len(@CSVValue) ...