Program for perform - until, COBOL Programming

PROGRAM FOR PERFORM ...UNTIL

We have to write a program to find the sum of "n" natural numbers.

Identification division.

Program- id. PerfUntil.

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 until i > n.

             Display(10 5) " Sum = " sum.

             Stop run.

Calc-para.

  Compute sum = sum + i.

             Add 1 to i.

Posted Date: 10/17/2012 7:45:37 AM | Location : United States







Related Discussions:- Program for perform - until, Assignment Help, Ask Question on Program for perform - until, Get Answer, Expert's Help, Program for perform - until Discussions

Write discussion on Program for perform - until
Your posts are moderated
Related Questions
ADD VERB: The ADD Verb can be used to find the sum of two or more numbers and to store the sum.  The ADD verb takes any one of the two forms as shown below:

PROGRAM FOR SIZE ERROR:   We have to write an easy program to elaborate the size error option. Identification division. Program- id. sizeerr. Environment division.

Illustration of Subtract verb: (a) SUBTRACT A FROM B. This illustration means that the value of A will be subtracted from the value of B and the subtracted result will be s

Figurative Constants: The Figurative constants have several fixed names and the compiler recognizes these names and it sets up the equivalent values in the object program.

MERGE VERB WITH OUTPUT PROCEDURE: Like the sort verb, the merge verb can also have an output procedure. The syntax of the MERGE verb is as shown below:   The r

ROUNDED OPTION: Let us consider the DATA DIVISION entries which are as shown below: Now, subsequent to the execution of the statement ADD A B GIVING C, the C will hold

OCCURS - INDEXED BY PROGRAM: identification division. program- id. searching. environment division. data division. working-storage section. 01 table1.      0

LEVEL NUMBERS: The COBOL makes use of the level number concept to explain the hierarchical data structure. A level number is a 2 digit number. The permitted level numbers a

Environment Division: The Environment Division is the second division in the COBOL source program. It is mainly machine-dependent . The computer and all the peripheral dev

Illustration of the abbreviation: A few illustration of the abbreviation are given below: Illustration: The compound condition  AMOUNT GREATER THAN 499 AND AMOUNT L