早教吧作业答案频道 -->其他-->
新手上路Fortran初编程,不知问题在哪,怎么改?programmainLOGICALPP=.FALSE.READ*,MI=2K=sqrt(M)DO10WHILE(.NOT.P.AND.I.LE.K)IF(MOD(M,I).EQ.0)P=.TRUE.10CONTINUEIF(P)THENPRINT*,M,'不是素数!'ELSEPRINT*,M,'是素数!'ENDIF
题目详情
新手上路 Fortran初编程,不知问题在哪,怎么改?
program main
LOGICAL P
P=.FALSE.
READ *,M
I=2
K=sqrt(M)
DO 10 WHILE(.NOT.P.AND.I.LE.K)
IF(MOD(M,I).EQ.0)P=.TRUE.
10 CONTINUE
IF (P) THEN
PRINT*,M,'不是素数!'
ELSE
PRINT*,M,'是素数!'
ENDIF
END
--------------------Configuration:xm3 - Win32 Debug--------------------
Compiling Fortran...
C:\Program Files\Microsoft Visual Studio\MyProjects\new3\chengxu2\xm3.f90
C:\Program Files\Microsoft Visual Studio\MyProjects\new3\chengxu2\xm3.f90(29) :Warning:Arguments' data types are incompatible with intrinsic procedure,assume EXTERNAL.[SQRT]
K=sqrt(M)
--^
Linking...
xm3.obj :error LNK2001:unresolved external symbol _SQRT@4
Debug/xm3.exe :fatal error LNK1120:1 unresolved externals
Error executing link.exe.
xm3.exe - 2 error(s),1 warning(s)
program main
LOGICAL P
P=.FALSE.
READ *,M
I=2
K=sqrt(M)
DO 10 WHILE(.NOT.P.AND.I.LE.K)
IF(MOD(M,I).EQ.0)P=.TRUE.
10 CONTINUE
IF (P) THEN
PRINT*,M,'不是素数!'
ELSE
PRINT*,M,'是素数!'
ENDIF
END
--------------------Configuration:xm3 - Win32 Debug--------------------
Compiling Fortran...
C:\Program Files\Microsoft Visual Studio\MyProjects\new3\chengxu2\xm3.f90
C:\Program Files\Microsoft Visual Studio\MyProjects\new3\chengxu2\xm3.f90(29) :Warning:Arguments' data types are incompatible with intrinsic procedure,assume EXTERNAL.[SQRT]
K=sqrt(M)
--^
Linking...
xm3.obj :error LNK2001:unresolved external symbol _SQRT@4
Debug/xm3.exe :fatal error LNK1120:1 unresolved externals
Error executing link.exe.
xm3.exe - 2 error(s),1 warning(s)
▼优质解答
答案和解析
Program www_fcode_cn Implicit None integer :: i , j , k , m Logical p p = .False. &nbs...
看了新手上路Fortran初编程,...的网友还看了以下:
西语:ocurrírsele(auno)algo的用法?看到例句是:Unabuenaideasel 2020-04-27 …
computercanonedaythinkandfeel(true,truly)这里填true, 2020-05-13 …
勒死你勒的拼音是leī还是lēi 2020-05-16 …
有"溅"这个意思的bēng字怎么写?就身边路过一辆车bēng了一身泥点子的bēng.还有液体在布和 2020-05-17 …
学而时习之不亦什么乎?乐字读音是“le”?还是“yue”?有朋自远方来不亦乐乎.念le? 2020-05-21 …
几道简单的英语填空part2(小六)Hermotheroftenwatcheshersatnigh 2020-05-21 …
“我勒个去”的拼音准确写法!“我勒个去”的这个勒到底是读le还是lei(指的是在网络中的读法) 2020-05-24 …
乐游原中的乐字怎样读李商隐的乐游原中的乐字读le还是、ye 2020-06-09 …
汉字读音大汇总1.李煜词选“清平乐”的“乐”是读yue(第四声)还是读le(第四声)“清平乐”中" 2020-06-10 …
时人不识余心乐中的了读什么音请问哪位知道“乐”在这里读le还是yue? 2020-06-22 …