I am trying to write this program, it runs fine but I can't get the imaginary numbers to print correctly. I have been trying this for a few hours now and cant figure it out. Here is the code, I am running Force 2.0. Thanks in advance for the help.(adsbygoogle = window.adsbygoogle || []).push({});

Program Quad

Implicit None

Real Root1, Root2, a, b, c, discri

Complex Croot1, Croot2

2 Write (*,*) 'Enter 3 numbers'

Read (*,*) a,b,c

discri=(b**2-(4*a*c))

If (discri.lt.0) Then

Write (*,*) 'Roots are Complex'

Croot1=(-b+SQRT(abs(b**2-4*a*c))/2*a)

Croot2=(-b-SQRT(abs(b**2-4*a*c))/2*a)

Write (*,*) 'Root 1 is',Croot1

Write (*,*) 'Root 2 is',Croot2

Else

Write (*,*) 'Roots are Real'

Root1=(-b+SQRT(abs(b**2-4*a*c))/2*a)

Root2=(-b-SQRT(abs(b**2-4*a*c))/2*a)

Write (*,*) 'Root 1 is',Root1

Write (*,*) 'Root 2 is',Root2

End If

Goto 2

End

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Quadratic fortran program help

**Physics Forums | Science Articles, Homework Help, Discussion**