Skip to content

Instantly share code, notes, and snippets.

@YoiTaka
Created November 16, 2016 11:43
Show Gist options
  • Save YoiTaka/d1c24ffb2449dc5cca505e6d870f4fbf to your computer and use it in GitHub Desktop.
Save YoiTaka/d1c24ffb2449dc5cca505e6d870f4fbf to your computer and use it in GitHub Desktop.
円の体積を計算(2パターン)
C234567
IMPLICIT REAL*8(A-H,O-Z)
write(*,*) 'r,N='
read(*,*) r,N
PI=3.1415926d0
dx=r/N
v=0.0
DO 100 I=1,N+1
x=dx*(I-1)
y=r*r-x*x
v=y*PI*dx+v
100 CONTINUE
v= v*2
v1=4.0d0/3.0d0*r*r*r*PI
write(*,*) v,v1
stop
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment