Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Fortran programming: How can I assign value to a specific element in a 2-D array

ID: 672500 • Letter: F

Question

Fortran programming: How can I assign value to a specific element in a 2-D array. That value is related to the input from keyboard.

                    If I want to assign a(2,1) the value of epsilon, which is 10**g, how should I write the statement? There's error when I type "data a(2,1) /10**g/.

Imain program 2 3 4 program gauss elimination implicit real*8 (a-h, o-z) real*8:: g parameter (ne-8) dimension a (ne,ne) , c(ne, ne), double precision a, c,b, d, x 6 b (ne)d (ne),x (ne) 9load number of equations, n, and value of epsilon, epsln 10 parameter (n-8) print*, "Please input number k" read*, g print*, 'epsilon is equal to',10**g 12 13 15 16load matrix elements into array a(i,j) 17 18 data a (1,1), a (1,2), a (1,3),a (1,4) /0,-5,6,4/ data a (1,5) a (1,6), a (1,7), a (1,8) /-2,-3,8,1/

Explanation / Answer

a(2,1)/eps