program main
integer::A,I,N ! 声明变量类型
A=1
I=1
read(*,*)N
10 if( I.lt.N) then ! 这里只能用数字,不能用字母
I=I+1
A=A*I
goto 10 ! 同上,这里只能用数字,不能用字母
endif
print*,'A=',A
read(*,*) !可以不要,只是为了停住计算界面
end
帮你解决了两个问题。
第一,不能用字母符号作为IF的标记,用数字;
第二,计算的IF内部的判断语句是lt(小于)而不是le(小于等于)
program main
a=1
i=1
read(*,*)n
100 if(i.lt.n)then
i=i+1
a=a*i
goto 100
endif
print *,'A=',a
read(*,*)
end program main
gives is how it affects your