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
Chat with our AI personalities
ax2 + bx + c
computer scince
Write the quadratic equation in the form ax2 + bx + c = 0 The roots are equal if and only if b2 - 4ac = 0. The expression, b2-4ac is called the [quadratic] discriminant.
First, write the equation in standard form, i.e., put zero on the right. Then, depending on the case, you may have the following options:Factor the polynomialComplete the squareUse the quadratic formula
Just write the equation as: (x - 11)(x - 3) = 0 and convert it to any form you like.