Re: [問題] 開文件求平均

作者: cloudo (一步一腳印)   2013-11-25 11:57:32
※ 引述《Laoda245566 (草莓獸)》之銘言:
: integer x, y, sum
: real mean
: open(unit=1,file='Gradeold.txt')
: read(1,*)x,y
: sum=0
: do i=1,62
: sum=sum+y
: end do
: mean=sum/62
: write(*,*)"mean",mean
: end
: 請問一下
: 哪裡打錯了
: 我怎麼執行都是100
: 感謝
Program Test1
implicit none
integer x,i
real mean, y(1000), sum
open(unit=1,file='Gradeold.txt')
do i=1,62
read(1,*) x,y(i)
end do
sum=0
do i=1,62
sum=sum+y(i)
end do
mean=sum/62
write(*,*)"mean",mean
stop
end program
待業中無聊一Po
作者: charlesdc (MoOn)   2012-01-26 01:17:00
拜託這種作業文就別回了...... 只會讓他一直上來發問

Links booklink

Contact Us: admin [ a t ] ucptt.com