Advertisement
joseleonweb

Untitled

Aug 26th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.38 KB | None | 0 0
  1. public class ProgramaMisterios {
  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 = 1;
  8.     int resultat = 0;
  9.     while (array[i] != 9) {
  10.       if (array[i - 1] < array[i]) {
  11.         resultat++;
  12.       }
  13.       i++;
  14.     }
  15.     System.out.println("El resultat és " + resultat + ".");
  16.   }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement