Code:

PROGRAM quadratic
real :: a,b,c
real :: discrm, x, y
print*
print*
print*, ' 2'
print*, ' A x + B x + C = 0'
print*
write(*,'(A)',advance='no') 'Enter coefficients A, B, C: '
read*, A, B, C
print 97, A,B,C
x = -b / (2*a)
discrm = b*b - 4*a*c
if ( discrm < 0 ) then ! COMPLEX ROOTS
y = sqrt(-discrm) / (2*a)
print 99, 1, x, ' +', y
print 99, 2, x, ' -', y
else ! REAL ROOTS
y = sqrt(discrm) / (2*a)
print 98, 1, x+y
print 98, 2, x-y
end if
97 format(/,F8.3,' x^2 +',F8.3,' x + ',F8.3,' = 0',/)
98 format('Root #', I1, ' is x=', F12.6)
99 format('Root #', I1, ' is x=', F12.6,A,F12.6,' i')
END