Fortran sqrt()错误

时间:2015-10-06 00:53:49

标签: fortran

我是Fortran的新手,我坚持使用以下程序来找到使用二次方程的根。

显示以下错误:

  

d = sqrt(bsq \ xE2 \ x80 \ x93 ac4)   1   错误:参数列表中的语法错误(1)

program quadratic
implicit none 
real :: a, b, c, root1, root2
real :: bsq, ac4, d 
print *, 'Please enter the coefficients a, b, and c as real numbers'
read *, a, b, c
bsq = b*b
ac4 = 4*a*c 
if ( bsq < ac4) then
d = sqrt(bsq – ac4)
root1 = (-b+d)/(2*a)
root2 = (-b+d)/(2*a)
print *, 'The real roots are ', root1, root2
else if ( root1==root2) then
root1 = root2
print *, 'There is one real root which is ', root1
else
print *, 'There are no real roots'
end if
end program quadratic   

1 个答案:

答案 0 :(得分:1)

您需要在bsqac4之间使用减号,而不是短划线。仔细看。

减号: -
短跑: -