
Le sujet :
Tof prétend pouvoir écrire un programme permettant de retrouver deux nombres a et b à partir de leur somme S et de leur produit P.En effet,sa maman lui a dit que les nombres en question sont toujours les racines du trinôme x²-Sx+P
Par exemple pour S=17 et P=60 on constate que 5 et 12 sont bien les racines du trinôme x²-17x+60
Ecrire ce programme à l'aide du logiciel Algobox
Voici mon algorithme:
VARIABLES
S EST_DU_TYPE NOMBRE
P EST_DU_TYPE NOMBRE
D EST_DU_TYPE NOMBRE
a EST_DU_TYPE NOMBRE
b EST_DU_TYPE NOMBRE
DEBUT_ALGORITHME
LIRE S
LIRE P
S PREND_LA_VALEUR a+b
P PREND_LA_VALEUR a*b
D PREND_LA_VALEUR (S*S)-4*P
SI (D>0) ALORS
DEBUT_SI
a PREND_LA_VALEUR S+sqrt(D)%2
b PREND_LA_VALEUR S-sqrt(D)%2
AFFICHER a
AFFICHER b
FIN_SI
FIN_ALGORITHME
Je dois le rendre bientôt.. Merci à ceux qui prendront le temps de m'aider
