Building a Primitive Calculator in Cobol :-
IDENTIFICATION DIVISION.
PROGRAM-ID. CALC.
ENVIRONMENT DIVISION.
DATA DIVISION.
01 A PIC 9999 VALUE ZERO.
01 B PIC 9999 VALUE ZERO.
01 C PIC 9999 VALUE ZERO.
01 M PIC A(3).
PROCEDURE DIVISION.
MAIN-PARA.
DISPLAY "ENTER 1ST NUMBER :".
ACCEPT A.
DISPLAY "ENTER 2ND NUMBER :".
ACCEPT B.
DISPLAY "ENTER ACTION: ADD/SUB/MUL/DIV :"
ACCEPT S.
IF S = "ADD" OR "add"
COMPUTE C = A + B.
IF S = "SUB" OR "sub"
COMPUTE C = A - B.
IF S = "MUL" OR "mul"
COMPUTE C = A * B.
IF S = "DIV" OR "div"
COMPUTE C = A / B.
DISPLAY "REQUIRED RESULT : " C.
STOP RUN.
Output-Output - Cobol Code to Create a Calculator |
This is very interesting content! I have thoroughly enjoyed reading your points and have come to the conclusion that you are right about many of them. You are great. 140 lbs to kg
ReplyDeleteHey, M is S !!!
ReplyDelete