Skip to content

Instantly share code, notes, and snippets.

@zrhans
Created May 8, 2018 01:55
Show Gist options
  • Save zrhans/52442a6384e5c2c85582e90d5d4fd2f3 to your computer and use it in GitHub Desktop.
Save zrhans/52442a6384e5c2c85582e90d5d4fd2f3 to your computer and use it in GitHub Desktop.
program volumes
implicit none
real, parameter :: pi = 3.14159265359
real :: volume = 0.0
integer :: raio
! iterando 10 vezes
open(unit=10, file='volumes.csv', status='unknown')
do raio = 1, 10
! V = 4/3.pi.r^3
volume = (4.0 / 3.0) * pi * raio**3
!Escrevendo na tela
!write(*,*)raio, volume
! Armazenando em um arquivo
write(10,*)raio,',',volume
end do
close(10)
stop 'programa finalizado!!!'
end program volumes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment