Home   Easy-Code    Forum  Updater 
Twitter Facebook



Program to find the saddle point of a matrix using cobol

Critics Rating:

Users Rating:

* PROGRAM TO FIND THE SADDLE POINT OF A MATRIX

**********************************************

   IDENTIFICATION DIVISION.

   PROGRAM-ID.

   ENVIRONMENT DIVISION.

   DATA DIVISION.

   WORKING-STORAGE SECTION.

   01 ARRAY.

    02 X OCCURS 5 TIMES.

    03 Y OCCURS 5 TIMES.

    04 A PIC 9(2).

   77 M PIC 9.

   77 N PIC 9.

   77 I PIC 9.

   77 J PIC 9.

   77 E PIC 9(2).

   77 P PIC ZZ9.

   PROCEDURE DIVISION.

   MAIN-PARA.

      DISPLAY "ENTER THE ORDER OF A MATRIX".

      ACCEPT M.

      ACCEPT N.

      COMPUTE E = M * N.

      DISPLAY " ENTER " E " NUMBERS ".

      PERFORM X-PARA VARYING I FROM 1 BY 1 UNTIL I > M

              AFTER J FROM 1 BY 1 UNTIL J > N.

      DISPLAY (1 , 1) ERASE.

      DISPLAY (1 , 1) "THE GIVEN MATRIX IS "

      PERFORM D-PARA VARYING I FROM 1 BY 1 UNTIL I > M.

      COMPUTE E = M + 2.

      MOVE E TO LIN.

      DISPLAY (LIN , 1) "THE TRANSPOSE IS".

      PERFORM Y-PARA VARYING I FROM 1 BY 1 UNTIL I > N.

      STOP RUN.

   X-PARA.

      ACCEPT A( I , J ).

   D-PARA.

      MOVE 25 TO COL.

      MOVE I TO LIN.

      PERFORM K-PARA VARYING J FROM 1 BY 1 UNTIL J > N.

   K-PARA.

       MOVE A(I , J) TO P.

      DISPLAY (LIN , COL) P.

      COMPUTE COL = COL + 3.

   Y-PARA.

      MOVE 25 TO COL.

      PERFORM Z-PARA VARYING J FROM 1 BY 1 UNTIL J > M.

      COMPUTE E = E + 1.

      MOVE E TO LIN.

   Z-PARA.      

      MOVE A(J , I) TO P.

    DISPLAY (LIN , COL) P

      COMPUTE COL = COL + 3.

Courtesy, Source, References & Regards: Kishore AVGK

While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright@2009-2011 by KuGuNi.com. All Rights Reserved.