Advertisement
Raizekas

Untitled

Jan 27th, 2016
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Rask paskutinę didžiausią reikšmę.
  2.  
  3. static int Max (int[] M)
  4. {
  5.     int max=0;
  6.     int index=0;
  7.     for(int i=0; i<M.Length; i++)
  8.     {
  9.         if(max<M[i])
  10.         {
  11.             max=M[i];
  12.             index=i;
  13.         }
  14.         if(max==M[i] && index<i)
  15.         {
  16.             index=i;
  17.             max=M[index];
  18.         }
  19.     }
  20.     return max;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement