Please guide on this interview question, What is the content of RESULT after execution of the following COBOL instruction. The start value of RESULT is 0.
Code: Select all
PERFORM VARYING C FROM 1 BY 1 UNTIL C = 6
ADD 1 TO RESULT
END-PERFORM
Code: Select all
PERFORM VARYING C FROM 1 BY 1 UNTIL C = 6
ADD 1 TO RESULT
END-PERFORM
Code: Select all
77 C PIC 9(04) COMP.
77 RESULT PIC 9(04).
PROCEDURE DIVISION.
000-START.
PERFORM VARYING C FROM 1 BY 1 UNTIL C = 6
ADD 1 TO RESULT
END-PERFORM.
DISPLAY 'C= ' C ' RESULT= ' RESULT.
Code: Select all
C= 0006 RESULT= 0005
You need to be a member in order to post a reply
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute