用fortran编程怎么输出第100个素数啊?怎么写代码?用fortran编程怎么输出第100个素数啊?怎么写代码?
1条回答 默认 最新
- 浪客 2021-08-03 08:52关注
上学的时候学的fortran,看来还没忘干净
program main logical :: log = .false. counts=0 n=2 do do i = 2, n-1 if ( mod(n,i) == 0 ) then log = .true. exit else continue end if log = .false. end do if (.not.log) then counts=counts+1 if(counts==100) then exit endif end if n=n+1 end do print*, n end
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用 3