Saturday, 19 July 2014

PROGRAM TO FIND THE AREA AND CIRCUMFERENCE OF A CIRCLE



PROGRAM TO FIND THE AREA AND CIRCUMFERENCE OF A CIRCLE


   IDENTIFICATION DIVISION.

   PROGRAM-ID.

   ENVIRONMENT DIVISION.

   DATA DIVISION.

   WORKING-STORAGE SECTION.

   77 R PIC 9(2).

   77 A PIC 9(4)V9(2).

   77 C PIC 9(4)V9(2).

   77 P PIC Z(4).9(2).

   PROCEDURE DIVISION.

   MAIN-PARA.

      DISPLAY " ENTER THE RADIUS OF A CIRCLE ".

      ACCEPT R.

      COMPUTE A = 3.14 * ( R ** 2 ).

      MOVE A TO P.

      DISPLAY " AREA IS " P.

      COMPUTE C = 2 * 3.14 * R.

      MOVE C TO P.

      DISPLAY " CIRCUMFERENCE IS " P.

No comments: