! x=0.0, 0.1, ..., 1.0 のそれぞれの2乗を足すプログラム(倍精度) ! 履歴 ! 2013/04/25 村橋 究理基 作成 program ex3_double implicit none real(8) :: x ! 2乗を入れる変数 real(8) :: res ! 結果を入れる変数 ! 変数の初期化 x = 0.0d0 res = 0.0d0 write(*, *) "x=0.0, 0.1, ..., 1.0の2乗の和" ! x=0.0, 0.1, ..., 1.0の2乗を足すループ 開始 do while (x <= 1.0d0) res = res + x**2 x = x + 0.1d0 write(*, *) "x =", x enddo ! x=0.0, 0.1, ..., 1.0の2乗を足すループ 終了 !結果の書き出し write(*, *) "x =", x, res end program ex3_double