Question: Function getMinimumInt ( integer array ( 5 ) userVals ) returns integer minInt / / Modified Error 1 : Pass the array value with size
Function getMinimumIntinteger array userVals returns integer minInt
Modified Error : Pass the array value with size of
integer i
minInt userVals
Iterating the array and finding the min of the array
Modified Error : Iterate the loop from zero rather
for i ; i userVals.size; i i
if userValsi minInt
minInt userValsi
Function Main returns nothing
integer array
integer array userVals
taking user input and storing it the array
integer i
Modified Error : Declare the variable here rat
than below the getting an error on Line :
Variable declaration must be at top of function.
integer min
for i ; i userVals.size; i i
userValsi Get next input
Don't declare integer min here
min getMinimumIntuserVals
normalizing the array
for i ; i userVals.size; i i
userValsi userValsi min
printing the output
Put userValsi to output
Put to output this is the code I used however I am getting the error message An array index of is too large; valid range of userVals: how would I correct this? I followed the above example verbatim
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
