complex z1,z2,dc real a,b,c,d,x1,x2 print*,'Consider the quadratic equation: f(x) = a*x**2 + b*x + c = 0' 1 print*,'Enter a,b,c and I''ll find the roots!' read*,a,b,c if(a.eq.0)goto1 d=b**2-4*a*c if(d.gt.0.)then x1=(-b+sqrt(d))/(2*a) x2=(-b-sqrt(d))/(2*a) print*,'For x1=',x1 print*,'f(x1)=',a*x1**2 + b*x1 + c print*,'For x2=',x2 print*,'f(x2)=',a*x2**2 + b*x2 + c elseif(d.eq.0.)then x1=(-b)/(2*a) print*,'The double root is x=',x1 print*,'f(x)=',a*x1**2 + b*x1 + c else dc=cmplx(d,0.) z1=(-b+sqrt(dc))/(2*a) z2=(-b-sqrt(dc))/(2*a) print*,'For z1=',z1 print*,'f(z1)=',a*z1**2 + b*z1 + c print*,'For z2=',z2 print*,'f(z2)=',a*z2**2 + b*z2 + c endif goto1 end