Question: Number 3 and 4 in Fortran code. Write a Fortran program that defines two one-dimensional arrays, each with 20 real elements. Use the array constructor

Number 3 and 4 in Fortran code.

Number 3 and 4 in Fortran code. Write a Fortran program that

Write a Fortran program that defines two one-dimensional arrays, each with 20 real elements. Use the array constructor notation we discussed in lecture to initialize the values of the first array to the following values (you may cut and paste these to save some typing): 0.1557 -0.4643 0.3491 0.4340 0.1787 0.2577 0.2431 -0.1078 0.1555 -0.3288 0.2060 -0.4682 -0.2231 -0.4538 -0.4029 0.3235 0.1948 -0.1829 0.4502 -0.4656 Make sure that no line in your program is longer than 80 characters. Remember that the ampersand character & allows you to continue a line. Initialize the second array with zeros. Then, fill the second array with the sum of all of the values in the first array up to that point. In other words, the value in the first element of the second array will be 0.1557, the value of the second element of the second array will be 0.1557 + -0.4643 = -0.3086. Use a loop to print out the second array, 5 elements at a time. Write a Fortran program that takes the first one-dimensional array from problem 2 and uses reshape to store the values in a 4 times 5 array. Use a loop to print the array one row at a time. Write a Fortran program that takes the first one-dimensional array from problem 2 and uses reshape to store the values in a 4 times 5 array. Use a loop to print the array one row at a time. 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. Write a Fortran program that defines two one-dimensional arrays, each with 20 real elements. Use the array constructor notation we discussed in lecture to initialize the values of the first array to the following values (you may cut and paste these to save some typing): 0.1557 -0.4643 0.3491 0.4340 0.1787 0.2577 0.2431 -0.1078 0.1555 -0.3288 0.2060 -0.4682 -0.2231 -0.4538 -0.4029 0.3235 0.1948 -0.1829 0.4502 -0.4656 Make sure that no line in your program is longer than 80 characters. Remember that the ampersand character & allows you to continue a line. Initialize the second array with zeros. Then, fill the second array with the sum of all of the values in the first array up to that point. In other words, the value in the first element of the second array will be 0.1557, the value of the second element of the second array will be 0.1557 + -0.4643 = -0.3086. Use a loop to print out the second array, 5 elements at a time. Write a Fortran program that takes the first one-dimensional array from problem 2 and uses reshape to store the values in a 4 times 5 array. Use a loop to print the array one row at a time. Write a Fortran program that takes the first one-dimensional array from problem 2 and uses reshape to store the values in a 4 times 5 array. Use a loop to print the array one row at a time. 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

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!