pls if u can solve this problem by fortran program 95/2003 it\'s long question b
ID: 3821236 • Letter: P
Question
pls if u can solve this problem by fortran program 95/2003 it's long question but short and easy answer I am do glad A) Write a function that receives a one- dimensional array of size of real variables. The function returns the average of the array. Write only the function. Do not write the main program. Don't use whole array operation. Write a program to: 1. Ask the user to enter 4 one- dimensional arrays (a, b, c and d) each of size 10 of real values. 2. Ses the function in part (a) to compute the average of each array and stores the averages in one-dimensional array y of size 4. 3. Uses the function in (a) to compute the average of array y. 4. Writes the results. Write only the main program. Do not write the function here. Don't use whole array operation.Explanation / Answer
C PROGRAM TO FIND THE AVERAGE.
DIMENSION DTA(900)
C READ TOTAL NUMBERS
READ 10, N
10 FORMAT(I3)
C READ N NUMBERS
DO 20 I = 1, N
READ 30, DTA(I)
30 FORMAT(F10.6)
IF(DTA(I)) 25,20,20
25 DTA(I) = -DTA(I)
20 CONTINUE
C CALCULATE SUM OF NUMBERS
SUM = 0.0
DO 40 I=1, N
SUM = SUM + DTA(I)
40 CONTINUE
C CALCULATE THE AVERAGE AND PRINT
AVG = SUM/FLOAT(N)
PRINT 50, AVG
50 FORMAT(1H ,F10.6)
STOP
END
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.