Question
Question 10: Assume this code: Dim Nums(Y) As Integer Assume later we filled the array Nums with integer values. Write one line of code thatcalculates
Question 10:
Assume this code:
Dim Nums(Y) As Integer
Assume later we filled the array Nums with integer values.
Write one line of code thatcalculates the average of: the first and the last element of Nums. Display the average in a messagebox.
Question 11:
Assume that an array z, is declared as in: Dim z(n) As Integer
andthat zhas been filled with data in all its locations, and n is an odd number.
<-- array content is integer values
0123 n <--index or location
Write code that uses aforloop, to calculate the average of everyother numberin z starting from location 0 to location ninclusive.
Since n is an odd number the for loop can start at the first location and end at the last location of z.
Think of what the step should be so we process one element then skip the next one and move on to the one after that.
After the loop show the resulting averagein a messagebox. Think about the number of elements we need to divide by is half of the elements between locations 0 and n.
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