Skip to content

Instantly share code, notes, and snippets.

@zrhans
Last active May 21, 2016 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zrhans/ade57b1ccf74c619036580ae9a92fdca to your computer and use it in GitHub Desktop.
Save zrhans/ade57b1ccf74c619036580ae9a92fdca to your computer and use it in GitHub Desktop.
program fatorial
implicit none
! define variaveis
integer :: nfact = 1
integer(kind=1) :: n
! calculando o fatorial
print*,' n | FATORIAL'
print*,'========================'
do n = 1,20
nfact = nfact * n
! mostrando valores de n e seu fatorial
if (n == 8) cycle
if (nfact < 0 ) stop 'Limite do tipo Integer alcaçado.'
print*,n, nfact
end do
end program fatorial
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment