2
program equacao
implicit none
real a,b,c,q
real x3,x2,x1
character s,n,read,if
complex sqrt
100 print*, "Esse programa calcula equacoes do 2 grau"
write (*,*) "De os valores de a, b, c(respectivamente)"
read (*,*) a,b,c
q = (b**2)-4*a*c
x1 = (-b+sqrt(q) ) / (2*a)
x2 = (-b-sqrt(q) ) / (2*a)
x3 = (-b) / 2*a
if (q .lt. 0) then
print*, "Nao existe x real"
endif
if (q .gt. 0) then
print*, "delta=",q
print*, "X' e X'' respectivamente=",x1,"e",x2
elseif (q .eq. 0) then
print*, "So existe uma raiz"
print*, x3
endif
write (*,*) "Calcular mais uma?(s/n)"
read (*,*) s,n
if (read .eq. s) then
do while (if .eq. s)
goto 100
enddo
elseif (read .eq. n) then
do while (if .eq. n)
goto 200
enddo
endif
stop
200 end