Algorithme

Fermé
minoucha - 6 nov. 2011 à 15:51
 bigbybob - 8 nov. 2011 à 09:08
bonjour j'ai un algorithme à écrire pou demain mais j'arrive ps à le faire je sais ps si vs pouvez m'aider je vs remercie à l'avance


_écrire un algorithme permettant de déterminer deux nombres connaissant leur somme S et leur produit P dans un langage naturel ou calculatrice

1 réponse

Salut, tu devrais éviter d'écrire en sms.

Enfin bref, en gros ton algo ressemblera plus ou moins a ça :

x + y = S 

x * y = P 



x = S - y 

Sy - yy = P 

-y^2 + Sy - P = 0 



delta = S^2 - 4*(-1)*(-P) 


x = [S - racine_carré(delta)]/2 

y = [S + racine_carré(delta)]/2
2