KEMBAR78
Algorithm To Find The Coefficient of X | PDF
0% found this document useful (0 votes)
57 views5 pages

Algorithm To Find The Coefficient of X

The document describes an algorithm and program to find the coefficients of a quadratic equation. It includes: 1) An algorithm that accepts coefficients a, b, c and uses the quadratic formula to calculate the discriminant d and solutions x1 and x2. 2) A flowchart representing the algorithm. 3) A Fortran program that implements the algorithm, prompting the user to input coefficients and printing the solutions. 4) A second Fortran program that accepts integers a, b, c and prints the largest number.

Uploaded by

Hollyfat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views5 pages

Algorithm To Find The Coefficient of X

The document describes an algorithm and program to find the coefficients of a quadratic equation. It includes: 1) An algorithm that accepts coefficients a, b, c and uses the quadratic formula to calculate the discriminant d and solutions x1 and x2. 2) A flowchart representing the algorithm. 3) A Fortran program that implements the algorithm, prompting the user to input coefficients and printing the solutions. 4) A second Fortran program that accepts integers a, b, c and prints the largest number.

Uploaded by

Hollyfat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

NAME: OLAYIWOLA OLAYINKA TINUOLA

MATRIC NO: CS201501489PT

Algorithm to find the coefficient of x

Start

Accept a,b,c

Compute d = √(b^2 – 4*a*c)

Compute x1 = (-b + (d) / 2*a)

Compute x2 = (-b - (d) / 2*a)

Write x1

Write x2

End
Flowchart

Start

Accept a,b,c

Compute d = √(b^2 – 4*a*c)

Compute x1 = (-b + (d) / 2*a)

Compute x2 = (-b - (d) / 2*a)

Write x1,x2

Stop
Program

PROGRAM AlmightyFormular

IMPLICIT NONE

INTEGER ::a,b,c

REAL ::d,x1,x2

WRITE (*,10) "Enter a"

10 FORMAT (I3)

READ (*,20) a

20 FORMAT (I3)

WRITE (*,30) "Enter b"

30 FORMAT (I3)

READ (*,40) b

40 FORMAT (I3)

WRITE (*,50) "Enter c"

50 FORMAT (I3)

READ (*,60) c

60 FORMAT (I3)

d = (b**2) - (4*a*c)

x1 = (-b + SQRT(d)) / (2*a)


x2 = (-b - SQRT(d)) / (2*a)

WRITE (*,*) x1

WRITE (*,*) x2

END PROGRAM AlmightyFormular

TWO

Program to find the biggest number

PROGRAM BiggestNo

IMPLICIT NONE

INTEGER ::a,b,c

a=3

b=5

c=7

IF ((a .GT. b) .AND. (a .GT. b)) THEN

WRITE (*,10) a

ELSE IF ((b .GT. a) .AND. (b .GT. c) ) THEN

WRITE (*,10) b

ELSE IF ((c .GT. a) .AND. (c .GT. b) ) THEN

WRITE (*,10) c

END IF
10 FORMAT (I2)

END PROGRAM BiggestNo

You might also like