大学院情報処理演習 第 1 回 (イントロダクション / Ruby と Fortran) 「Fortran のプログラム例」 講義ノート目次

Fortran は、C 言語の開発前から存在する言語で、 大型計算機のプログラムはこれで書かれている割合が高いという調査もある。

ファイル名は本学の環境では example.f とし、


      program example
      implicit none
      integer i, total
      total = 0
      do i = 0,9
         total = total + i
      end do
      write(*,*) total
      end program 

実行は Kterm で gfortran example.f とし、できあがったバイナリファイル ./a.out を実行して調べる。

Fortran 95

Fortran 77 から規格が変更され、 近年の言語で便利な機能を取り入れるようになった。