Friday, August 12, 2016

Addition of Two Numbers in Cobol

Hi there this will be my first time to write a simple program in COBOL or Common Business Oriented Language to find the sum of the two numbers. In this sample program I am using OPENCOBOLIDE as my cobol compiler. The code is very simple and easy to understand.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.


My mobile number here in the Philippines is 09173084360.
 
 

Sample Program Output


Program Listing

******************************************************************
* Author: MR. JAKE R. POMPERADA
* Date: AUGUST 12, 2016
* Purpose: FIND THE SUM OF TWO NUMBERS
******************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. ADDITION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 NUM_1 PIC 9(4).
77 NUM_2 PIC 9(4).
77 SOLVE_SUM PIC 9(4).
PROCEDURE DIVISION.
PARA.
DISPLAY "SUM OF TWO NUMBERS IN COBOL".
DISPLAY "".
DISPLAY "ENTER THE FIRST VALUE : ".
ACCEPT NUM_1.
DISPLAY "ENTER THE SECOND VALUE : ".
ACCEPT NUM_2.
COMPUTE SOLVE_SUM = NUM_1 + NUM_2.
DISPLAY "THE TOTAL SUM IS ".
DISPLAY SOLVE_SUM.
STOP RUN.



 

 

1 comment: