Question: How to use a loop to determine the largest integer in the list of 20 random integers

 

 

hello, 

i need to use only looping to determine the larget integer in my random list...

here is how i put it together, but my result is incorrrect... Please help.

thank you

R:=rand(1..50)

seq(R(1..50),i=1..20)

L:=[%]

max:=proc(L,maxv : : evaln)

locali;

maxv:=L[i];

for i from 1 to nops(L) do

if eval(maxv)<L[i] then maxv:=L[i]end if;
end do;

end proc;

 

Please Wait...