i need the code for this program in cobol.
2 + 1 = 3
4+3=7
6+5=11
8+7=15
10+9=19

Answers were Sorted based on User's Feedback



i need the code for this program in cobol. 2 + 1 = 3 4+3=7 6+5=11 8+7=15 10+9=19 ..

Answer / aj

do a loop on below equation . Varying n from 1 to required
value
(2n) + (2n-1)

Is This Answer Correct ?    11 Yes 2 No

i need the code for this program in cobol. 2 + 1 = 3 4+3=7 6+5=11 8+7=15 10+9=19 ..

Answer / xxx

PERFORM VARYING X FROM 1 BY 1 UNTIL WS-ANS = 19
COMPUTE WS-ANS = (2 * X) + ((2 * X) - 1)
DISPLAY WS-ANS
END-PERFORM

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More COBOL Interview Questions

period is missing in the cobol program which error we getting

5 Answers   TCS, Tesco,


How many sections are there in data division?.

10 Answers   Amdocs, TCS,


What are various search techniques in cobol? Explain.

0 Answers  


What is different between variable length and fixed length?

2 Answers   TCS,


There is a variable with value 19446. Requirement is to convert it to 194.46. I tried it by doing divide by 100 and my receiving field data type is 9(03)v99. But the output is 194. I am not getting the decimal value. Could anyone pls let me know how to get this done?

2 Answers  






What type of Call you would use if you don;t want the control back to the calling program?

8 Answers   TCS,


The below is the declaration for a variable ws 01 ws pic 9(3). if you want to insert space how will you do that. in which level u should do it

3 Answers   ADP,


What is the difference between next sentence and continue in cobol programing language?

0 Answers  


In a COBOL II PERFORM statement, when is the conditional tested, before or after the perform execution?

3 Answers  


subscript and index r not coded in u r application program what will happen?

2 Answers  


I have 2 dimensional array with having 100 elements. So how to find the 11th item in an array?

6 Answers   IBM,


How do we get current date from system with century in COBOL?

0 Answers   Winsol Solutions,


Categories