演習問題1b

1) 例題1の「プログラムの例1c」を各自のファイルとして作成し、コンパイル・実行せよ。データには次の数値の組を使用すること。

        25    30    
         2    19    
        51     3    
       122     3    
        11    34    
       192   524    


2) 次の内容のファイルをファイル名 enshu01b.d で作成せよ。

データ
 1
 2
 3
 4
 5
 6
    25    30    
     2    19    
    51     3    
   122     3    
    11    34    
   192   524    


3) 1)のプログラムを次のように修正し、コンパイル・実行せよ。

プログラム
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
c Example 1c_2     四則演算
c  建築学科 2年  xxxxxxx  my name
c234567890  File = reidai1c2.f
      integer m,n,wa,sa,seki,sho,amari
      open(8,file='enshu01b.d',status='old')
  101 continue
      read(8,*,end=901)  m,n 
      wa=m+n
      sa=m-n
      seki=m*n
      sho=m/n
      amari=m-n*sho
      write(*,*) m,n,wa,sa,seki,sho,amari
      go to   101
  901 write(*,*)  ' 計算終わり '
      close(8)
      stop
      end