Advertisement
joseleonweb

Untitled

Aug 26th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.43 KB | None | 0 0
  1. public class UnAltreProgramaMisterios {
  2.  
  3.   public static final int[] array = {1, 6, 4, 8, 3, 7, 3, 6, 9, 4, 2, 9, 6};
  4.  
  5.   public static void main(String[] args) {
  6.  
  7.     int i = array.length - 1;
  8.     int resultat = 0;
  9.  
  10.     while(i > (array.length / 2)) {
  11.       if (array[i] == 4) {
  12.         resultat--;
  13.       } else {
  14.         resultat++;
  15.       }
  16.     }
  17.     System.out.println("El resultat Ês " + resultat + ".");
  18.  
  19.   }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement