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>
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.
You're using the wrong notation for 'not equal to'. Fortran syntax is /= or .NE..
So you should be using:
if (prim(i) /= 0 .and. modulo(n, prim(i)) == 0) then
and
if (prim(i) /= 0) then
Furthermore, your syntax of integer(sqrt(real(m))) is incorrect, perhaps you mean NINT(sqrt(real(m)))?
Well, this is Fortran and ! denotes a comment. So the compiler actually sees
if (prim(i)
which is no valid statement. The error message you see reflects that.
"Not equal" in Fortran is /= or .ne.:
if (prim(i) /= 0 .and. modulo(n, prim(i)) == 0) then
and, later on:
if (prim(i) /= 0) then