Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The programming language is FORTRAN 90: Here is the input file (data.txt): 53.3 31.7 58.7 53.3 -29.7 -38.2 109.8 -30.9 -54.5 35.4 89.9 53.8 -27.6
The programming language is FORTRAN 90:
Here is the input file (data.txt):
53.3
31.7
58.7
53.3
-29.7
-38.2
109.8
-30.9
-54.5
35.4
89.9
53.8
-27.6
2.7
18.3
106.9
-33.4
85.4
49.6
4.0
-27.5
12.8
21.9
-39.5
40.2
-21.5
5.4
39.1
-17.2
-10.6
44.9
-14.9
80.1
107.1
64.1
-1.5
39.3
-41.7
94.1
89.5
79.0
-15.7
41.0
-56.2
12.3
-6.8
-32.5
-29.6
11.9
-44.0
41.7
20.1
58.3
59.0
48.6
-54.3
-48.3
-5.7
30.2
51.3
9.3
79.4
62.1
104.7
30.3
-4.7
-42.0
43.9
72.4
12.0
-44.6
-14.7
-33.9
-12.2
14.8
29.6
17.8
88.8
28.1
100.4
48.4
102.8
-19.1
54.9
-10.9
54.2
58.2
-48.4
LAB07 Use of user defined function The provided data file (data.txt) is a 1D-array consisted of 88 positive and negative real number elements. The below code (Lab07.190) reads the array from data.txt and wants to sum all the positive elements and print it on the screen as you can figure out from line 12. At this line, you can see that Lab07.190 uses positivesum function to do this task. You should modify Lab07.890 by adding positivesum as its local function to complete the task. Upload your modified Lab07.190 into eClass by the due date. Hint: you can use do-loop and conditional statements in your function to do this task. You can also use the sum command and its other features in your function. program lab07 implicit none integer, parameter:: n=88 real:: dat (n) integer:: i open(1, file='data.txt') do i=1, n read (1,10) dat (i) enddo 10 format (F6.1, 1x) close (1) print 20, 'the sum of all positive elements is:', positivesum (dat) 20 format (a, F7.2) end program labo7|Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started