C programme de résolution d'une équation du second degré C dans tous les cas. Cours F77 P.TRAU program seconddeg implicit none real a,b,c,delta,x1,x2,x print *,'a ?' read *,a print *,'b ?' read *,b print *,'c ?' read *,c if (a.NE.0) then delta=b*b-4*a*c if (delta.GT.0) then x1=(-b-sqrt(delta))/(2*a) x2=(-b+sqrt(delta))/(2*a) print *,'2 racines : ',x1,' et ',x2 elseif (delta.EQ.0) then x=-b/(2*a) print *,'1 racine double : ',x else print *,'aucune racine réelle' endif else print *,'c''est en fait une équation du premier ordre' if (b.NE.0) then x=-b/c print *,'une solution :',x elseif (c.NE.0) then print *,'aucune solution à ',c,'=0' else print *,'tout x satisfait 0x=0' endif endif stop end program C testez avec 1 -3 2 ; 1 -2 1 ; 1 1 1 ; 0 1 1