Syntax error when using “X != 0” in Fortran

前端 未结 3 1464
无人共我
无人共我 2021-01-19 00:59

I have a problem with my Fortran program that does nothing more than calculating a prime factorization (or should do). That\'s the error:

C:\\MinGW\\Fortran>         


        
3条回答
  •  孤城傲影
    2021-01-19 01:39

    The token for "not equals" in fortran is /= . ! starts a comment, hence the compiler reading line 15 as

            if (prim(i) 
    

    and so is confused because there is no bracket to close the logical expression in the if statement. So simply replace != with /= and it should get rid of this problem.

提交回复
热议问题