Suite de Fibonacci
Description du code
Code source ou contenu du fichier
Code cobol (Suite de Fibonacci) (50 lignes)
IDENTIFICATION DIVISION. PROGRAM-ID. FIBONACCI. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 77 N PIC 9(18). 77 N1 PIC Z(18). 77 M PIC 9(18) VALUE 1. 77 O PIC 9(18). 77 I PIC 9(4) VALUE 1. 77 Q PIC X. PROCEDURE DIVISION. PARA-A. DISPLAY ( 1 , 1 ) ERASE. DISPLAY ( 2 , 1 ) "FIBONACCI NUMBERS FROM 1 TO 100 ARE:". MOVE 0 TO N. DISPLAY " ". DISPLAY 0. DISPLAY 1. MOVE 0 TO O. PARA-B. COMPUTE N = O + M. MOVE N TO N1. MOVE M TO O. MOVE N TO M. DISPLAY N1. ADD 1 TO I. IF I = 21 DISPLAY "PRESS TAB KEY TO VIEW NEXT PAGE." ACCEPT Q. IF I = 41 DISPLAY "PRESS TAB KEY TO VIEW NEXT PAGE." ACCEPT Q. IF I = 61 DISPLAY "PRESS TAB KEY TO VIEW NEXT PAGE." ACCEPT Q. IF I = 81 DISPLAY "PRESS TAB KEY TO VIEW NEXT PAGE." ACCEPT Q IF I = 99 GO TO STOP-PARA ELSE GO TO PARA-B. STOP-PARA. DISPLAY " ". STOP RUN.
Autres extraits de codes en cobol
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 05/10/2009, last modified the 28/10/2018
Source of the printed document:https://www.gaudry.be/en/sniplet-rf-cobol/fibonacci-iter.cob.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.