petergade 发表于 2004-6-25 15:22:11

freepu 发表于 2004-6-25 21:26:54

回复: 【求助】fortran簡單問題

看样子,这位兄台来自台湾了?试试下面的:

PROGRAM AVRG
!
INTEGER, PARAMETER :: N = 3
REAL (4) :: SCORE(N), POINT(N)
REAL (4) :: SUMS, SUMP, AVG
INTEGER :: I
!
DATA SCORE/80.0, 85.0, 87.0/
DATA POINT/2.0, 3.0, 1.0/
!
SUMS = 0.0
SUMP = 0.0
DO I = 1, N
    SUMS = SUMS + SCORE(I) * POINT(I)
    SUMP = SUMP + POINT(I)
END DO
AVG = SUMS/SUMP
!
WRITE(*, *) 'YOUR AVERAGE SCORE IS ', AVG
!
END PROGRAM AVRG

看样子,你还没有怎么学编程是么?

petergade 发表于 2004-6-26 19:51:04

页: [1]
查看完整版本: 【求助】fortran簡單問題