===============================================================================
試題說明 :
===============================================================================
給定fortran77程序prog1.for,其功能是給定20個(gè)數(shù)據(jù),計(jì)
算并輸出這些數(shù)據(jù)與平均值之差的絕對(duì)值之和。
請(qǐng)編寫該程序,最后運(yùn)行程序。其中部分程序與輸出子程序
writedat在程序中已經(jīng)給出,不得修改。
===============================================================================
程序 :
===============================================================================
dimension a(20)
data a/3.5,1.5,-2.5,4.5,2.5,3.0,5.5,-6.5,3.5,2.5,
* 1.5,2.5,4.5,-3.0,2.6,3.4,6.3,-3.8,5.2,-1.6/
write(*,100) s
100 format(1x,'s=',e12.4)
write(*,*)
call writedat(s)
end
subroutine writedat(s)
open(10,file='bc05.out',status='new')
write(10,100) s
100 format(1x,e12.4)
end
===============================================================================
所需數(shù)據(jù) :
===============================================================================
@3 $bc05.out 001
|.5337e+02
#e
試題說明 :
===============================================================================
給定fortran77程序prog1.for,其功能是給定20個(gè)數(shù)據(jù),計(jì)
算并輸出這些數(shù)據(jù)與平均值之差的絕對(duì)值之和。
請(qǐng)編寫該程序,最后運(yùn)行程序。其中部分程序與輸出子程序
writedat在程序中已經(jīng)給出,不得修改。
===============================================================================
程序 :
===============================================================================
dimension a(20)
data a/3.5,1.5,-2.5,4.5,2.5,3.0,5.5,-6.5,3.5,2.5,
* 1.5,2.5,4.5,-3.0,2.6,3.4,6.3,-3.8,5.2,-1.6/
write(*,100) s
100 format(1x,'s=',e12.4)
write(*,*)
call writedat(s)
end
subroutine writedat(s)
open(10,file='bc05.out',status='new')
write(10,100) s
100 format(1x,e12.4)
end
===============================================================================
所需數(shù)據(jù) :
===============================================================================
@3 $bc05.out 001
|.5337e+02
#e