Created
November 16, 2016 11:43
-
-
Save YoiTaka/d1c24ffb2449dc5cca505e6d870f4fbf to your computer and use it in GitHub Desktop.
円の体積を計算(2パターン)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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