Logo 
Search:

Cobol Articles

Submit Article
Home » Articles » Cobol » Homework HelpRSS Feeds

Program to add two numbers

Posted By: Poppy Brown     Category: Cobol     Views: 20204

Write a Program to add two numbers.

Code for Program to add two numbers in Cobol

       IDENTIFICATION DIVISION.
       PROGRAM-ID.


       ENVIRONMENT DIVISION.


       DATA DIVISION.
       WORKING-STORAGE SECTION.
       77 A PIC 9999.
       77 B PIC 9999.
       77 ANS PIC 999v99.


       PROCEDURE DIVISION.
       MAIN-PARA.
           DISPLAY " ----------------------------------------------- ".
           DISPLAY " ENTER A ".
           ACCEPT A.
           DISPLAY " ENTER B ".
           ACCEPT B.
           DISPLAY " ----------------------------------------------- ".

       ADD-PARA.
           ADD A B GIVING ANS. 
           DISPLAY " -----------------------------------------------".

       DISP-PARA.
           DISPLAY "A IS " A.
           DISPLAY "B IS " B.
           DISPLAY "ADDITION =" ANS.
           STOP RUN.
  
Share: 


Didn't find what you were looking for? Find more on Program to add two numbers Or get search suggestion and latest updates.

Poppy Brown
Poppy Brown author of Program to add two numbers is from London, United Kingdom.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!