chap04/kadai3.f90

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

 1program answer
 2  implicit none
 3
 4  real(8), parameter :: pi = atan(1.0_8) * 4.0_8
 5  integer :: i, n
 6  real(8) :: theta, radian, theta1, theta2, dtheta
 7
 8  theta1 = 0.0_8
 9  theta2 = 180.0_8
10  dtheta = 10.0_8
11
12  n = int((theta2 - theta1) / dtheta)
13
14  do i = 0, n
15    theta = dtheta * i
16    radian = theta / 180.0_8 * pi
17    write(*, *) theta, sin(radian), cos(radian)
18  enddo
19
20  stop
21endprogram answer