HP 39g Graphing Calculator Instrukcja Użytkownika Strona 124

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 155
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 123
124 Chapitre 7 Programmes d’arithm´etique
7.1.1 Traduction algorithmique
-Version it´erative
Si B 6= 0 on calcule R=A mod B, puis avec B dans le ole de A (en
mettant B dansA)etRdans le ole de B ( en mettant R dans B)
on recommence jusqu’`a ce que B=0, le PGCD est alors A.
Fonction PGCD(A,B)
Local R
tant que B 6= 0 faire
A mod B->R
B->A
R->B
ftantque
esultat A
ffonction
-Version ecursive
On ´ecrit simplement la efinition ecursive vue plus haut.
Fonction PGCD(A,B)
Si B 6= 0 alors
esultat PGCD(B,A mod B)
sinon
esultat A
fsi
ffonction
7.1.2 Traduction HP40G
-Version it´erative pour deux entiers
On ´ecrit tout d’abord le sous-programme IN qui permet d’entrer deux
nombres A et B :
INPUT A;"A";;;1:
INPUT B;"B";;;1:
ERASE:
puis on ´ecrit le programme PGCD :
RUN IN:
DISP 3;"PGCD "{A,B}:
WHILE B 6= 0 REPEAT
Przeglądanie stron 123
1 2 ... 119 120 121 122 123 124 125 126 127 128 129 ... 154 155

Komentarze do niniejszej Instrukcji

Brak uwag