Skip to content

Instantly share code, notes, and snippets.

@zrhans
Last active May 15, 2017 23:03
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/c024860d5ccf7b8b6113bf1dbdb8914d to your computer and use it in GitHub Desktop.
Save zrhans/c024860d5ccf7b8b6113bf1dbdb8914d to your computer and use it in GitHub Desktop.
Códigos do portalfisica
program chama_func
implicit none
real :: a
real :: area_do_circulo !!! IMPORTANTE declarar o tipo função quando externa
a = area_do_circulo(2.0)
print *, "A área do circulo com raio 2.0 é "
print *, a
end program chama_func
! Esta função calcula a área de um círculo de raio r
function area_do_circulo(r)
implicit none
! argumentos fictícios
real :: area_do_circulo
! variaveis locais
real :: r
real :: pi
pi = 4 * atan (1.0)
! resultado da função
area_do_circulo = pi * r**2
end function area_do_circulo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment