answersLogoWhite

0


Best Answer

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

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a fortran code to calculate the root of quadratic equation?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write an algorithm and draw a flowchart that will calculate the roots of quadratic equation?

dejene


Write an algorithm to find the root of quadratic equation?

Write an algorithm to find the root of quadratic equation


How did you write each quadratic equation in standard form?

readuse the answer


How do you write a poem on the roots of the quadratic equation?

2000X=Y2KoverZzz?


How can you write a complete fortran program to calculate a simple interest siprt100 given principal rate and time?

Solve simple intress usin fortran


How would you go about solving a quadratic equation?

Write the quadratic equation in the form ax2 + bx + c = 0 then the roots (solutions) of the equation are: [-b ± √(b2 - 4*a*c)]/(2*a)


How do you write a pseudo code for find the quadratic equation?

computer scince


How do you write a quadratic equation in standard form?

ax2 + bx + c


When the roots are equal of a quadratic equation?

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.


Is write a FORTRAN command?

Yes. The FORTRAN write command output's data to a file.


What are all the ways you can solve a quadratic equation?

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


Algorithm to find the roots of a quadratic equation?

The easiest way to write a generic algorithm is to simply use the quadratic formula. If it is a computer program, ask the user for the coefficients a, b, and c of the generic equation ax2 + bx + c = 0, then just replace them in the quadratic formula.