Fortranを学ぶ
C&Fortran による数値計算プログラミング入門 改訂版
- 作者: 服部裕司
- 出版社/メーカー: 共立出版
- 発売日: 2009/02/10
- メディア: 単行本
- この商品を含むブログを見る
c---+----1----+----2----+----3----+----4----+----5----+----6----+- program calc c integer Number1, Number2 integer Sum, Diff, Multiply, Div, Power c write(6,*) ' Input the Number 1:' read(5,*) Number1 write(6,*) 'Input the Number 2:' read(5,*) Number2 c Sum =Number1 + Number2 Diff = Number1 - Number2 Multiply = Number1 * Number2 Div = Number1 / Number2 Power = Number1 ** Number2 c write(6,*) Number1, ' + ' , Number2, ' = ', Sum write(6,*) Number1, ' - ' , Number2, ' = ', Diff write(6,*) Number1, ' * ' , Number2, ' = ', Multiply write(6,*) Number1, ' / ' , Number2, ' = ', Div write(6,*) Number1, ' ** ' , Number2, ' = ', Power c stop end
gfortran myprogram.f ./a.out
c---+----1----+----2----+----3----+----4----+----5----+----6----+- program main complex x,y write(6,*) 'Input x:' read(5,*) x write(6,*) 'Input y:' read(5,*) y write(6,*) 'x**y=', x**y stop end