Re: Fibonacci program



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
>


.



Relevant Pages

  • Re: Reading complex multidimensionalarrays from C
    ... are not guaranteed that a particular compiler supports what might be ... support of double precision complex is guaranteed by the standard ... extension and thus that the requirement for a corresonding complex ... I don't buy that rationalization because I don't think such ...
    (comp.lang.fortran)
  • Re: COBOL "non-myth" confirmed - Index and subscripts (MF on Windows)
    ... number of multiplys and optimization may be just the same. ... I'll wager 100US it shows the offset from the beginning of the table on my compiler, ... The 02 Standard allows one to define native types with BINARY-SHORT and BINARY-LONG. ... allow that extension if the appropriate flags are on, ...
    (comp.lang.cobol)
  • Re: Multi precision floating point
    ... extension is a string function called strdup. ... If it compiles on every ideal, conforming C compiler then it requires ... I believe that one common technique for using the features that you correctly point out are not part of standard C is to wrap them into a small part of your program, and write the main part in Standard C which calls a wrapper function when it wants to use a nonstandard feature. ...
    (comp.lang.c)
  • Re: Multi precision floating point
    ... language extension. ... the offsetof() macro was provided by the quote that I have included ... The standard library macro defined in, ... compiler accepts a program with a syntax error or a constraint violation, ...
    (comp.lang.c)
  • Re: creating directories on the fly
    ... system is not a standard intrinsic subroutine. ... > Tools" that comes with the compiler. ... Although the SYSTEM subroutine does not belong to the Fortran ... i don't get an indication that I'm using an extension... ...
    (comp.lang.fortran)