chap03/kadai4.f90

サンプルコードのダウンロード

 1program answer
 2  implicit none
 3
 4  complex(8), parameter :: cunit = (0.0_8, 1.0_8)
 5  real(8) :: x, y
 6  complex(8) :: z
 7
 8  read(*, *) z
 9
10  x = real(z)
11  y = aimag(z)
12
13  write(*, *) exp(z)
14  write(*, *) exp(x) * (cos(y) + cunit * sin(y))
15
16  stop
17endprogram answer