======================================================================
試題說明 :
======================================================================
補充編制fortran77程序prog1.for,其功能是計算并輸出級
數和
1 1 (-1)^n
s(n)=x - ─x^3 + ─x^5 - ... + ── x^(2n+1)
3 5 2n+1
直到s(n)-s(n-1)<0.000001為止。其中x=0.7。
請編寫該程序,最后運行程序。其中部分程序與輸出子程序
writedat在程序中已經給出,不得修改。
======================================================================
程序 :
======================================================================
write(*,100) s
100 format(1x,'s=',e12.4)
write(*,*)
call writedat(s)
end
subroutine writedat(s)
open(10,file='bc01.out',status='new')
write(10,100) s
100 format(1x,e12.4)
end
======================================================================
所需數據 :
======================================================================
@3 $bc01.out 001
|.6107e+00
#e
試題說明 :
======================================================================
補充編制fortran77程序prog1.for,其功能是計算并輸出級
數和
1 1 (-1)^n
s(n)=x - ─x^3 + ─x^5 - ... + ── x^(2n+1)
3 5 2n+1
直到s(n)-s(n-1)<0.000001為止。其中x=0.7。
請編寫該程序,最后運行程序。其中部分程序與輸出子程序
writedat在程序中已經給出,不得修改。
======================================================================
程序 :
======================================================================
write(*,100) s
100 format(1x,'s=',e12.4)
write(*,*)
call writedat(s)
end
subroutine writedat(s)
open(10,file='bc01.out',status='new')
write(10,100) s
100 format(1x,e12.4)
end
======================================================================
所需數據 :
======================================================================
@3 $bc01.out 001
|.6107e+00
#e