Friday, July 31, 2015

Addition of Two Numbers in Cobol

Cobol is one of the earliest high level language know to us it stands for Common Business Oriented Language it is develop by Admiral Grace Hooper the first person who write the first compiler. In this program that I wrote it will ask the user to enter two numbers and then our program will display the total sum of two number given by our user.

If you have some questions about programming, about my work please send mu an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at  my mobile number 09173084360.

Thank you very much and Happy Programming.




Sample Program Output




Program Listing

 IDENTIFICATION DIVISION.
       PROGRAM-ID. ADD01.
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  FIRST-NUMBER      PICTURE IS 99999.
       01  SECOND-NUMBER     PICTURE IS 99999.
       01  THE-RESULT        PICTURE IS 99999.
       PROCEDURE DIVISION.
       PROGRAM-BEGIN.
               DISPLAY "===== ADDITION OF TWO NUMBERS =====".
               DISPLAY "Enter the first number :".
               ACCEPT FIRST-NUMBER.
               DISPLAY "Enter the second number :".
               ACCEPT SECOND-NUMBER.
               ADD FIRST-NUMBER, SECOND-NUMBER GIVING THE-RESULT.
  DISPLAY "The result is : ".
  DISPLAY THE-RESULT.
               STOP RUN.  

No comments:

Post a Comment