Guest User

Untitled

a guest
Jun 17th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. public class MetodoC {
  2.  
  3. public static void main(String[]args){
  4.  
  5. int v[]= {4,6,8,3,1,-1};
  6.  
  7. metodoC(v);
  8.  
  9.  
  10.  
  11. }
  12.  
  13. public static boolean metodoC(int[]v){
  14.  
  15. boolean val = true;
  16.  
  17. int d = v.length/2;
  18.  
  19. int x = v[0] + v[d];
  20.  
  21. for (int i = 1; i < d && val; i++){
  22.  
  23. int y = v[i] + v[d+i];
  24.  
  25. if ( ( y != x ) || ( v[i] % 2 == 1 ) )
  26.  
  27. val = false;
  28.  
  29. }
  30.  
  31. return val;
  32.  
  33. }
  34.  
  35. }
Add Comment
Please, Sign In to add comment