Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  dom.m
Language: FORTRAN
Code:
implicit double precision(a-h,o-z)
write(*,*) “please provide the a,b,c coeff”
read(*,*) A,B,C
D=B*B-4*A*C
if(D.GT.0) then
root1=(-B/(2*A))+(SQRT(D))/(2*A)
root2=(-B/(2*A))-(SQRT(D))/(2*A)
write(*,*) root1,root2
elseif(D.EQ.0) then
root1=(-B/(2*A))
root2=root1
write(*,*) root1,root2
else
root1=(-B/(2*A))+(SQRT(-D))/(2*A)
root2=(-B/(2*A))-(SQRT(-D))/(2*A)
a=(root1+root2)/2
b=(root1-root2)/2
write(*,*) ‘realpartroot=’,a, ‘complexpartroot=’,b
endif
stop
END          
Comments: