document final

publicité
Consigne donnée aux élèves :
« Construire sur Algobox un algorithme permettant de vérifier, à l'aide du théorème de
Pythagore, si un triangle dont on connait les coordonnées des sommets, est rectangle».
Connaissances utilisées :
Déclarer une variable, Lire une variable, Afficher un message, Afficher une variable,
Affecter une valeur à une variable, syntaxe de la fonction POW (puissance), syntaxe d'un
test SI-ALORS-SINON et contenant un OU, syntaxe d'un test d'égalité avec ==
Résultat final :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
VARIABLES
xa EST_DU_TYPE NOMBRE
ya EST_DU_TYPE NOMBRE
xb EST_DU_TYPE NOMBRE
yb EST_DU_TYPE NOMBRE
xc EST_DU_TYPE NOMBRE
yc EST_DU_TYPE NOMBRE
AB2 EST_DU_TYPE NOMBRE
AC2 EST_DU_TYPE NOMBRE
BC2 EST_DU_TYPE NOMBRE
DEBUT_ALGORITHME
LIRE xa
LIRE ya
LIRE xb
LIRE yb
LIRE xc
LIRE yc
AB2 PREND_LA_VALEUR pow(xb-xa,2)+pow(yb-ya,2)
AC2 PREND_LA_VALEUR pow(xc-xa,2)+pow(yc-ya,2)
BC2 PREND_LA_VALEUR pow(xb-xc,2)+pow(yb-yc,2)
SI (AB2+AC2==BC2 OU AB2+BC2==AC2 OU AC2+BC2==AB2) ALORS
DEBUT_SI
AFFICHER "Le triangle est rectangle"
FIN_SI
SINON
DEBUT_SINON
AFFICHER "Le triangle n'est pas rectangle"
FIN_SINON
FIN_ALGORITHME
Téléchargement