Ax^2+Bx+C=0(adsbygoogle = window.adsbygoogle || []).push({});

PROGRAM delta1

IMPLICIT NONE

REAL :: A,B,C

REAL :: DELTA,X1,X2

PRINT *,"Enter the a,b,and c"

READ *,A,B,C

delta=b**2-4*a*c

IF (delta>0)THEN

PRINT *,"The roots are real"

X1=(-B+SQRT(DELTA))/(2*A)

X2=(-B-SQRT(DELTA))/(2*A)

PRINT *,"X1 = ",X1,"X2 = ",X2

END IF

IF (delta==0)THEN

PRINT *,"There is one real root"

X1 = -B/(2*A)

PRINT *,"X = ",X1

END IF

IF (delta<0)THEN

PRINT *,"The roots are complex"

X1=(-B+SQRT(DELTA))/(2*A)

X2=(-B-SQRT(DELTA))/(2*A)

END IF

END PROGRAM delta1

How can i show the complex and real roots in this program above which shows only real roots?

**Physics Forums - The Fusion of Science and Community**

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

# FORTRAN:Simple question

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

Loading...

Similar Threads - FORTRAN Simple question | Date |
---|---|

Another simple fortran q | Sep 26, 2012 |

Simple fortran help | Sep 17, 2012 |

Help with a very simple fortran program. | Jan 22, 2012 |

Simple Fortran 90 questions | Nov 11, 2009 |

Simple FORTRAN question | Jun 11, 2008 |

**Physics Forums - The Fusion of Science and Community**