//Rask paskutinę didžiausią reikšmę.
static int Max (int[] M)
{
int max=0;
int index=0;
if(max<=M[i])
if(max<M[i])
return max;
index=i;