! (FIRST) roots of a 2nd degree equation with real coefficients program second_degree_eq implicit none real :: delta real :: z1, z2 real :: a, b, c print *,"Solving ax^2+bx+c=0, enter a, b, c:" read (*,*) a, b, c delta = sqrt(b**2 - 4.0*a*c) ! square root of discriminant z1 = -b + delta z2 = -b - delta z1 = z1/(2.0*a) z2 = z2/(2.0*a) write(*,*) "Real roots:", z1, z2 end program second_degree_eq