Re: Fibonacci program
- From: "William M. Klein" <wmklein@xxxxxxxxxxxxxxxxx>
- Date: Mon, 24 Oct 2005 19:49:19 GMT
I don't think you have told us what compiler (and operating system) you are
using. Your code is FULLY ANSI/ISO '85 Standard conforming (I think - I haven't
compiled it with a standards flagger).
Some *EXTENSION* to THAT Standard that various replies have used include:
1) Inline comments, i.e. lines with
*> this is a comment
in them
2) EXIT PERFORM statement
3) conditional expression with only literals (no data-items), e.g.
Until (1 < 0)
4) Procedure Division with no paragraph names in it.
***
Some of those are pretty common extensions to the '85 Standard - and others are
not. Several are *Standard* in the 2002 COBOL Standard.
My *personal* recommendation would be to keep coding STRICTLY '85 Standard
code - until/unless your instructor tells you about certain "extensions" to use.
You also need to know what IS and is not an extension in the compiler that you
are using - as they may or may not be the same as what your instructor or other
students have available.
--
Bill Klein
wmklein <at> ix.netcom.com
"spartacus" <schick.jonathan@xxxxxxxxx> wrote in message
news:1130166079.791746.296340@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> thanks all of you, guys
>
> i thought it through myself, and i succeeded.
> this is the result i got, and it's working.
>
> IDENTIFICATION DIVISION.
> PROGRAM-ID. Fibonacci.
> AUTHOR. Spartacus.
>
> ENVIRONMENT DIVISION.
> CONFIGURATION SECTION.
> Source-Computer. Cobol-85.
> Object-Computer. Cobol-85.
>
> DATA DIVISION.
> WORKING-STORAGE SECTION.
> 01 no1 PIC 9(4) VALUE 0001.
> 01 no2 PIC 9(4) VALUE 0000.
> 01 no3 PIC 9(4) VALUE 0000.
>
> PROCEDURE DIVISION.
> Hoofd.
> DISPLAY "Fibonacci Sequence"
> DISPLAY "******************"
> PERFORM 6 TIMES
> COMPUTE no2 = no3 + no1
> DISPLAY no2
> COMPUTE no3 = no1 + no2
> DISPLAY no3
> COMPUTE no1 = no2 + no3
> DISPLAY no1
> END-PERFORM.
> COMPUTE no2 = no3 + no1
> DISPLAY no2
> DISPLAY "***********"
> DISPLAY "END PROGRAM"
> STOP RUN
>
> Thanks though for your massive response.
>
> regards
> spartacus
>
.
- Follow-Ups:
- Re: Fibonacci program
- From: Judson McClendon
- Re: Fibonacci program
- References:
- Fibonacci program
- From: spartacus
- Re: Fibonacci program
- From: spartacus
- Fibonacci program
- Prev by Date: Re: Fibonacci program
- Next by Date: Re: Fibonacci program
- Previous by thread: Re: Fibonacci program
- Next by thread: Re: Fibonacci program
- Index(es):
Relevant Pages
|
|