SHARE
TWEET

Untitled

a guest Nov 14th, 2017 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program teste
  2.  
  3. integer :: fatorial
  4. integer :: a
  5.  
  6. a = fatorial(5)
  7.  
  8. print *, a
  9.  
  10. end program teste
  11.  
  12. recursive function fatorial(n) result (fac)
  13. integer :: n, fac  
  14.  
  15. if (n == 0) then
  16.   fac = 1
  17. else
  18.   fac = n * fatorial(n - 1)
  19. endif
  20.  
  21. end function fatorial
RAW Paste Data
Top