Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ***C**** ***O**** ***M**** ***M**** ***E**** ***N**** ***T****
- * PROGRAMA QUE CALCULA LA SUCESIÓN DE FIBONACCI. CALCULA SIN *
- * PROBLEMAS HASTA EL 85. PUEDE QUE PARA NÚMEROS MÁS GRANDES *
- * SE TENGA QUE UTILIZAR OTRO COMPILADOR DISTINTO A GNUCOBOL. *
- * LICENCIADO BAJO GNU GENERAL PUBLIC LICENCE (GNU GPL) 3.0 *
- ******** ******** F v q _ U k r a N a z i s ******* ********
- ***C**** ***O**** ***M**** ***M**** ***E**** ***N**** ***T****
- IDENTIFICATION DIVISION.
- PROGRAM-ID. XBZ0-FIB.
- AUTHOR JESUS GUSTAVO VARGAS PEREZ (XEBUZER0).
- INSTALLATION EN TU KORA :V .
- DATE-WRITTEN 22-DICIEMBRE-2019.
- DATE-COMPILED 22-DICIEMBRE-2019.
- REMARKS Al chile soy la mera v3rdur4 put05.
- ***C**** ***O**** ***M**** ***M**** ***E**** ***N**** ***T****
- ENVIRONMENT DIVISION.
- ***C**** ***O**** ***M**** ***M**** ***E**** ***N**** ***T****
- DATA DIVISION.
- WORKING-STORAGE SECTION.
- 01 WS-NUMBER PIC 9(18)V9(20) VALUE ZEROS.
- 01 WS-GOLDENRATIO-EQUATION-ROOTS.
- 02 RT1 PIC 9(18)V9(20) VALUE ZEROS.
- 02 RT2 PIC 9(18)V9(20) VALUE ZEROS.
- 01 WS-TOTAL PIC 9(18)V9(20) VALUE ZEROS.
- 01 WS-RZCU5 PIC 9(18)V9(20) VALUE ZEROS.
- ***C**** ***O**** ***M**** ***M**** ***E**** ***N**** ***T****
- PROCEDURE DIVISION.
- 000-PRINCIPAL.
- PERFORM 100-LEER-NUM.
- PERFORM 200-FIBONACCI.
- PERFORM 300-SALIR.
- 000-EXIT.
- EXIT.
- ***C**** ***O**** ***M**** ***M**** ***E**** ***N**** ***T****
- 005-SANITIZAR.
- IF WS-NUMBER < 0 THEN
- MULTIPLY WS-NUMBER BY -1 GIVING WS-NUMBER.
- 005-EXIT.
- EXIT.
- ***C**** ***O**** ***M**** ***M**** ***E**** ***N**** ***T****
- 010-INICIALIZA-RAICES.
- COMPUTE WS-RZCU5 = 5 ** 0.5.
- MOVE WS-RZCU5 TO RT1.
- ADD 1 TO RT1 GIVING RT1.
- DIVIDE RT1 BY 2 GIVING RT1.
- SUBTRACT 1 FROM RT1 GIVING RT2.
- DISPLAY RT1.
- DISPLAY RT2.
- DISPLAY WS-RZCU5.
- 010-EXIT.
- EXIT.
- ***C**** ***O**** ***M**** ***M**** ***E**** ***N**** ***T****
- 100-LEER-NUM.
- PERFORM 010-INICIALIZA-RAICES.
- DISPLAY "INGRESE NÚMERO ".
- ACCEPT WS-NUMBER.
- 100-EXIT.
- EXIT.
- ***C**** ***O**** ***M**** ***M**** ***E**** ***N**** ***T****
- 200-FIBONACCI.
- PERFORM 250-FIBODIRE.
- DISPLAY "EL NÚMERO DE FIBONACCI ES: " WS-TOTAL.
- 200-EXIT.
- EXIT.
- ***C**** ***O**** ***M**** ***M**** ***E**** ***N**** ***T****
- 250-FIBODIRE.
- COMPUTE RT1 = RT1 ** WS-NUMBER.
- COMPUTE RT2 = RT2 ** WS-NUMBER.
- ADD RT1 TO RT2 GIVING WS-TOTAL.
- DIVIDE WS-TOTAL BY WS-RZCU5 GIVING WS-TOTAL.
- ADD 0.1 TO WS-TOTAL ROUNDED.
- COMPUTE WS-TOTAL = FUNCTION INTEGER-PART(WS-TOTAL).
- 250-EXIT.
- EXIT.
- ***C**** ***O**** ***M**** ***M**** ***E**** ***N**** ***T****
- 300-SALIR.
- STOP RUN.
- 300-EXIT.
- EXIT.
- ***C**** ***O**** ***M**** ***M**** ***E**** ***N**** ***T****
Add Comment
Please, Sign In to add comment