Saturday, 1 March 2014

COBOL Program to Calculate Area of Circle using COMPUTE verb



COBOL Program to Calculate Area of Circle using COMPUTE verb

PROGRAM:  

       IDENTIFICATION DIVISION.
       PROGRAM-ID. CAREA.
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
          77 PI PIC 999V99.
          77 R PIC 9(4).
          77 A PIC 9999.9999.
       PROCEDURE DIVISION.
       MAIN-PARA.
           DISPLAY "ENTER THE VALURE OF R".
           ACCEPT R.
           DISPLAY "ENTER PI  VALUE ".
           ACCEPT PI.
           COMPUTE A = PI * ( R * R ).
           DISPLAY  A.
           STOP RUN.

No comments: