This preview shows page 1. Sign up to view the full content.
Unformatted text preview: program det implicit none ! Declare Variables real :: A, B, C, D logical :: X, Y, Z !Ask the user for the values of A, B, and C and read these in write(*,*) 'Enter values for A, B, and C:' read(*,*) A, B, C !Calculate the determinant based on the input values D = b**2 - (4*A*C) !Test to see if the determinant is less than, equal to, or greater than !zero X = (D < 0) Y = (D == 0) Z = (D > 0) !Display the results of the logical statements write(*,*) 'No real roots:', X write(*,*) 'One real root:', Y write(*,*) 'Two real roots:', Z stop end program...
View Full Document
- Spring '08
- Computer Programming