Skip to content

Instantly share code, notes, and snippets.

@anthonylgf
Last active May 23, 2018 01:43
Show Gist options
  • Save anthonylgf/4aa93e9992aa48a69f277b807e48c3a5 to your computer and use it in GitHub Desktop.
Save anthonylgf/4aa93e9992aa48a69f277b807e48c3a5 to your computer and use it in GitHub Desktop.
código fortran para desafio 02 programadores
program primos
implicit none
integer::i,j
logical::eh_primo=.FALSE.
!
!Para compilar o programa utilizei o gfortran do GNU Project
!
print *,"Lista de Primos entre 1-100000"
print *, 2
do j=3, 100000
eh_primo=.TRUE.
testar_quociente:do i=2, j-1
if(modulo(j,i) .eq. 0) then
eh_primo=.FALSE.
exit testar_quociente
end if
end do testar_quociente
!
if(eh_primo) then
print *,j
end if
end do
end program primos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment