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
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