FORTRAN
FORTRAN
sc (Organic chemistry)
1st Year
Subject: General Chemistry
Chapter-5
Microsoft Fortran
SYLLABUS:
Print x1,Cx2
stop
Fortran code:
!declaring variables
REAL::a,b,c,d,root1,root2,val
PRINT *, '============================================'
PRINT *, 'PROGRAM TO CALCULATE ROOTS OF A QUADRATIC EQUATION [REAL ROOTS ONLY] [ BY WWW.BOTTOMSCIENCE.COM ]'
PRINT *, '============================================'
PRINT *,'Please enter the value of cofficients a, b, and c respectively as per the equation - ax^2 + bx + c'
READ(*,*)a,b,c
val=((b**2)-(4*a*c))
d=SQRT(val)
root1=(-b+d)/(2*a)
root2=(-b-d)/(2*a)
PRINT *,'Calculated real roots are - root 1 = ',root1 ,'root 2 = ', root2
END PROGRAM
OUTPUT