58 lines
1.7 KiB
Plaintext
58 lines
1.7 KiB
Plaintext
|
IDENTIFICATION DIVISION.
|
|||
|
PROGRAM-ID. multpl.
|
|||
|
AUTHOR. OD.
|
|||
|
*----------------------------------------------------------------*
|
|||
|
* PROGRAMME *
|
|||
|
* VERIFICATION NOMBRE MULTIPLE D'UN AUTRE (IMPAIR) *
|
|||
|
*----------------------------------------------------------------*
|
|||
|
|
|||
|
ENVIRONMENT DIVISION.
|
|||
|
|
|||
|
DATA DIVISION.
|
|||
|
WORKING-STORAGE SECTION.
|
|||
|
*--------------------------*
|
|||
|
* DEFINITION DES VARIABLES *
|
|||
|
*--------------------------*
|
|||
|
* Nombre de d<>part
|
|||
|
77 NBR-DPRT PICTURE 99 VALUE ZERO.
|
|||
|
* Resultat dans la division euclidienne
|
|||
|
77 DV-ECLDN PICTURE 99 VALUE ZERO.
|
|||
|
* Reste dans la division euclidienne par 2
|
|||
|
77 RST PICTURE 9 VALUE ZERO.
|
|||
|
* Nombre impair ou pas ? (simulation d'un bool<6F>en)
|
|||
|
77 NBR PICTURE 99 VALUE ZERO.
|
|||
|
88 IMPAIR VALUE 1.
|
|||
|
* R<>sultat
|
|||
|
77 RSLTT PICTURE X(30).
|
|||
|
|
|||
|
PROCEDURE DIVISION.
|
|||
|
*--------------------*
|
|||
|
* DEBUT DU PROGRAMME *
|
|||
|
*--------------------*
|
|||
|
|
|||
|
PROGRAMME SECTION.
|
|||
|
|
|||
|
DEBUT.
|
|||
|
PERFORM SAISIE UNTIL IMPAIR.
|
|||
|
CORPS.
|
|||
|
PERFORM PARITE.
|
|||
|
FIN.
|
|||
|
DISPLAY RSLTT.
|
|||
|
STOP RUN.
|
|||
|
|
|||
|
SAISIR SECTION.
|
|||
|
SAISIE.
|
|||
|
DISPLAY "Saisissez un chiffre impair : "
|
|||
|
WITH NO ADVANCING.
|
|||
|
ACCEPT NBR-DPRT.
|
|||
|
PERFORM VERIF.
|
|||
|
VERIF.
|
|||
|
DIVIDE NBR-DPRT BY 2 GIVING DV-ECLDN REMAINDER RST.
|
|||
|
DISPLAY RST.
|
|||
|
IF (RST NOT EQUAL TO ZERO) THEN
|
|||
|
MOVE 1 TO NBR.
|
|||
|
PARITE.
|
|||
|
IF (IMPAIR) THEN
|
|||
|
MOVE "Le nombre est impair." TO RSLTT
|
|||
|
ELSE MOVE "Le nombre n'est pas impair." TO RSLTT.
|