Question
Complete this : IDENTIFICATION DIVISION PROGRAM-ID. Work1 as Work1. AUTHOR. Yourname DATA-DIVISION. WORKING-STORAGE SECTION. 01 Num1 PIC 999 VALUE ZEROS. 01 Num2 PIC 999 VALUE
Complete this :
IDENTIFICATION DIVISION PROGRAM-ID. Work1 as "Work1". AUTHOR. Yourname DATA-DIVISION. WORKING-STORAGE SECTION. 01 Num1 PIC 999 VALUE ZEROS. 01 Num2 PIC 999 VALUE ZEROS 01 Result PIC 999999 VALUE ZEROS. 01 Operator PIC X VALUE SPACE.
PROCEDURE-DIVISION. Calculator. PERFORM 3 TIMES DISPLAY "Enter First Number (max 3-digits) : " WITH NO ADVANCING ACCEPT Num1 DISPLAY "Enter Second Number (max 3-digits) : " WITH NO ADVANCING ACCEPT Num2 DISPLAY "Enter operator (+ or *) : " WITH NO ADVANCING ACCEPT Operator IF Operator = "+" THEN ADD Num1, Num2 GIVING Result END-IF IF Operetor = "*" THEN MULTIPLY Num1 BY Num2 GIVING Result END-IF DISPLAY "Result is = ", Result END-PERFORM. STOP RUN. END-PROGRAM Exercise1.
b.) correct the syntax errors on each of the 3 division lines.
c.) Run the program with the following 3 sets of inputs:
First Number: 123
Second Number: 234
Operator: +
First Number: 505
Second Number: 330
Operator: *
First Number: 900
Second Number: 895
Operator: *
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started