===============================================================================
試題說(shuō)明 :
===============================================================================
補(bǔ)充編制fortran77程序prog1.for,其功能是計(jì)算并輸出級(jí)
數(shù)和
1 1 1
s(n)=1 + x + ─x^2 + ─x^3 +... + ─x^n
2! 3! n!
直到s(n)-s(n-1)<0.000001為止。其中x=1.1。
請(qǐng)編寫該程序,最后運(yùn)行程序。其中部分程序與輸出子程序
writedat在程序中已經(jīng)給出,不得修改。
===============================================================================
程序 :
===============================================================================
write(*,100) s
100 format(1x,'s=',e12.4)
write(*,*)
call writedat(s)
end
subroutine writedat(s)
open(10,file='bc02.out',status='new')
write(10,100) s
100 format(1x,e12.4)
end
===============================================================================
所需數(shù)據(jù) :
===============================================================================
@3 $bc02.out 001
|.3004e+01
#e
試題說(shuō)明 :
===============================================================================
補(bǔ)充編制fortran77程序prog1.for,其功能是計(jì)算并輸出級(jí)
數(shù)和
1 1 1
s(n)=1 + x + ─x^2 + ─x^3 +... + ─x^n
2! 3! n!
直到s(n)-s(n-1)<0.000001為止。其中x=1.1。
請(qǐng)編寫該程序,最后運(yùn)行程序。其中部分程序與輸出子程序
writedat在程序中已經(jīng)給出,不得修改。
===============================================================================
程序 :
===============================================================================
write(*,100) s
100 format(1x,'s=',e12.4)
write(*,*)
call writedat(s)
end
subroutine writedat(s)
open(10,file='bc02.out',status='new')
write(10,100) s
100 format(1x,e12.4)
end
===============================================================================
所需數(shù)據(jù) :
===============================================================================
@3 $bc02.out 001
|.3004e+01
#e