06/05/10 19:38:12
>>301
「直交座標 極座標」でググればすぐ出て来るだろう、というのは置いといて
なんのひねりもなく作ると、
program hoge
implicit none
real, parameter :: PI = 3.14159265
real :: x, y, z, r, th, ph
print *, "x, y, z:"
read *, x, y, z
r = sqrt(x**2 + y**2 + z**2)
th = acos(z / r)
ph = atan2(y, x)
print *, "r, θ, φ"
print "(3F12.3)", r, th*180.0/PI, ph*180.0/PI
end program hoge