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

Need help with this code Fortran the array from problem 2 my code from problem 2

ID: 3885765 • Letter: N

Question

Need help with this code Fortran

the array from problem 2

my code from problem 2

program HW04_02
implicit none
real, dimension(20):: array1 , array2
integer :: i

array1 = (/ 0.2481, 0.4133, 0.4961, 0.4618, 0.3686, &
-0.0495, -0.3477, -0.4219, -0.4954, -0.4156, &
-0.4162, 0.3258, -0.0574, 0.2749, -0.1003, &
-0.2711, 0.0383, -0.3934, 0.3173, -0.2402/)
array2(1)=array1(1)
do i = 2, 20
array2(i)=array2(i-1)+array1(i)

end do
write(*,*) array2(1),array2(2),array2(3),array2(4),array2(5)
write(*,*) array2(6),array2(7),array2(8),array2(9),array2(10)
write(*,*) array2(11),array2(12),array2(13),array2(14),array2(15)
write(*,*) array2(16),array2(17),array2(18),array2(19),array2(20)

end program HW04_02

As in the previous problem, reshape the array from problem 2, but this time into a two arrays. a. Store the data into a 5 times 5 array, padding with 5 zeros. b. Store the data into a 5 times 5 array, padding with 5 zeros, but change the order to fill the rows before the columns. Be sure to print a line before printing the arrays, briefly saying which array is which. Then, print the array from part a with" R: "before each row and print the array from part b with " C: "before each row. See the output below as a guide for what this should look like and the numerical format. You should experiment with the formats to see how to get this to happen.

Explanation / Answer

MODIFIED

program HW04_02
implicit none
real, dimension(20):: array1 , array2
integer :: i
array1 = (/ 0.2481, 0.4133, 0.4961, 0.4618, 0.3686, &
-0.0495, -0.3477, -0.4219, -0.4954, -0.4156, &
-0.4162, 0.3258, -0.0574, 0.2749, -0.1003, &
-0.2711, 0.0383, -0.3934, 0.3173, -0.2402/)
array2(1)=array1(1)
do i = 2, 20
array2(i)=array2(i-1)+array1(i)
end do
write(*,*) array2(1),array2(2),array2(3),array2(4),array2(5)
write(*,*) array2(6),array2(7),array2(8),array2(9),array2(10)
write(*,*) array2(11),array2(12),array2(13),array2(14),array2(15)
write(*,*) array2(16),array2(17),array2(18),array2(19),array2(20)
end program HW04_02