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

Introduction to COBOL: In the year 1959, a new language named the COBOL ( CO mmon B usiness O riented L anguage) was introduced remembering the business purpose application

Illustration of indexed tables: Index items defined through the INDEXED phrase of the OCCURS clause are one type of indexes. There can be other type of index items that are de

PROGRAM TO FIND INTEREST ON BANK DEPOSITS: We have to write a program to find interest on deposits. The criteria is given below : identification division. program-

, (Comma) : A comma, whenever used in a picture, is considered as an insertion character and inserted wherever it become visible. There can be more than one comma in the pictu

STATEMENTS FOR SEQUENTIAL FILES: A basic operation on a file includes the reading and writing of its records. Whenever the file is sequential, there are three verbs for the

DELETE STATEMENT : The file should be opened in the I-O mode. If the access is SEQUENTIAL, the INVALID KEY phrase must be specified. Rather than, the last input-output state

Rules for Simple sort verb: The work file is to be defined by a sort elaboration entry (SD entry).The format of SD entry is as shown below. The rules below should be taken

Second form of Divide verb: The second form of this verb is as shown below: In this situation the identifier-1 or numeric- literal-1 will be divided by identifier-2 or

Format for COBOL Programs: The COBOL is a high-level language. Therefore, a COBOL program can be executed on a computer for which a COBOL compiler exists. The compiler transla