Boucle while en Pascal
Fermé
abdelkarim_jb
Messages postés
25
Date d'inscription
samedi 27 novembre 2010
Statut
Membre
Dernière intervention
5 juin 2011
-
19 janv. 2011 à 11:15
zyxx Messages postés 21 Date d'inscription mardi 16 novembre 2010 Statut Membre Dernière intervention 10 août 2016 - 26 janv. 2011 à 15:22
zyxx Messages postés 21 Date d'inscription mardi 16 novembre 2010 Statut Membre Dernière intervention 10 août 2016 - 26 janv. 2011 à 15:22
A voir également:
- Boucle while en Pascal
- Turbo pascal download - Télécharger - Édition & Programmation
- Bash do while ✓ - Forum Shell
- Pc s'allume et s'éteint en boucle - Forum Matériel informatique
- Factorielle en c boucle while - Forum C
- My pascal - Télécharger - Édition & Programmation
1 réponse
zyxx
Messages postés
21
Date d'inscription
mardi 16 novembre 2010
Statut
Membre
Dernière intervention
10 août 2016
26 janv. 2011 à 15:22
26 janv. 2011 à 15:22
salut comment vas tu? Moi je suis élève en Terminale H. Pour résoudre ton problème:
Program Boucle_whyle;
var Nb : Array [1..15] OF INTEGER;
Begin
I:=1;
Rep:=0;
Croi:=True;
Decroi:=True;
Notri:= True;
WHYLE Rep<>-1 DO BEGIN
REPEAT
WRITE ('Nombre ', I,':'); READLN (Nbre); UNTIL Nbre>=0;
Nb [I]:=Nbre;
I:=I+1;
WRITE ('Avez-vous un autre nombre?'');
READLN (Rep);
END;
FOR J:=1 TO I-1 DO BEGIN
FOR K:=J+1 TO I DO BEGIN
IF Nb[J]<Nb[K] THEN BEGIN
Tamp:=Nb[K];
Nb[K]:=Nb[J];
Nb[J]:=Tamp;
Program Boucle_whyle;
var Nb : Array [1..15] OF INTEGER;
Begin
I:=1;
Rep:=0;
Croi:=True;
Decroi:=True;
Notri:= True;
WHYLE Rep<>-1 DO BEGIN
REPEAT
WRITE ('Nombre ', I,':'); READLN (Nbre); UNTIL Nbre>=0;
Nb [I]:=Nbre;
I:=I+1;
WRITE ('Avez-vous un autre nombre?'');
READLN (Rep);
END;
FOR J:=1 TO I-1 DO BEGIN
FOR K:=J+1 TO I DO BEGIN
IF Nb[J]<Nb[K] THEN BEGIN
Tamp:=Nb[K];
Nb[K]:=Nb[J];
Nb[J]:=Tamp;