#포트란 #shorts #fortran #2차방정식 #quadratic_equations
program quadratic_equations
read(5,101) a,b,c
101 format(3f2.0)
write(6,102) a,b,c
102 format(3f2.0)
d=b*b-4*a*c
if(d) 10,20,30
10 r1=-b/(2*a)
d=abs(d)
r2=sqrt(d)/(2*a)
write(6,103) r1,r2,r1,r2
103 format('x1=',f5.2,'+',f5.2,/,'x2=',f5.2,'+',f5.2)
goto 100
20 r=-b/(2*a)
write(6,104) r
104 format('x=',f5.2)
goto 100
30 r1=(-b+sqrt(d))/(2*a)
r2=(-b-sqrt(d))/(2*a)
write(6,105) r1, r2
105 format('x1=',f5.2,'+',f5.2,/,'x2=',f5.2,'+',f5.2)
100 stop
end program quadratic_equations
https://youtu.be/QxvTnKxfkxI