Last active
May 23, 2018 01:43
-
-
Save anthonylgf/4aa93e9992aa48a69f277b807e48c3a5 to your computer and use it in GitHub Desktop.
código fortran para desafio 02 programadores
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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