Question: Need help with this COBOL problem please. Code the COBOL code required to handle the following logical statement. Assume all field declarations have been made

Need help with this COBOL problem please.

Code the COBOL code required to handle the following logical statement. Assume all field declarations have been made with the field names noted.

The gas efficiency of a car (GAS-EFF) has to be calculated as the liters consumed (LTRS) divided by the distance traveled (DIST) multiplied by 100. When the calculated gas efficiency is less than or equal to 5, the phrase EXCELLENT is displayed on the monitor.

Given the code below, predict what values will be displayed.

Identification division. program-id. my-first-program.

data division.

working-storage section.

01 field-definitions.

05 root pic 9(1) value 0.

05 square pic 9(3) value 0.

procedure division.

perform table-procedure 4 times.

stop run.

table-procedure.

add 2 to root.

display root square.

compute square = root ** 2.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!