PROGRAM FOR PERFORM - VARYING:
We have to write a program to elaborate PERFORM ...VARYING
Identification division.
Program- id. PerfVary.
Environment division.
Data division.
Working-storage section.
01 n pic 9(2) value 0.
01 i pic 9(2) value 1.
01 sum pic 9(4) value 0.
Procedure division.
Para-1.
Display(1 1) erase.
Display(5 5) "Enter a Number ".
Accept n.
Perform calc-para varying i from 1 by 1 until i > n.
Display(10 5) " Sum = " sum.
Stop run.
Calc-para.
Compute sum = sum + i.