need Fortran help my code from problem 2 program HW04_02 implicit none real, dim
ID: 3886170 • Letter: N
Question
need Fortran help
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
4. As in the previous problem, reshape the array from problem 2, but this time into a two arrays Store the data into a 5x5 array, padding with 5 zeros Store the data into a 5x5 array, padding with 5 zeros, but change the order to fill the rows before the columns a. b. 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 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 Second array, padded, using default order: R: 0.2481-0.04950.4162 -0.2711 0.0000 R: 0.4133-0.3477 0.3258 0.0383 0.0000 R 0.4961 0.4219 -0.0574 -0.3934 0.0000 R: 0.4618-0.4954 0.2749 0.3173 0.0000 R: 0.3686-0.4156 0.1003 -0.2402 0.0000 Third array, padded, filling columns first: C: 0.2481 0.4133 0.4961 0.4618 0.3686 C: -0.0495 -0.3477 -0.4219 0.4954 -0.4156 C: -0.4162 0.3258 -0.0574 0.2749 -0.1003 C: -0.2711 0.0383 0.3934 0.3173 -0.2402 C: 0.0000 0.0000 0.0000 0.0000 0.0000Explanation / Answer
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
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.