gwserver

Ocupar o array de forma contínua

Apr 23rd, 2021
562
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. public class Main {
  3.  
  4.     public static void main(String[] args) {
  5.  
  6.         int[] naoDivisiveisPor5 = new int[99];
  7.        
  8.         int indice = 0;
  9.  
  10.         for (int contador = 1; contador < 100; contador++) {
  11.  
  12.             if (contador % 5 == 0) {
  13.                 continue;
  14.             }
  15.             naoDivisiveisPor5[indice] = contador;
  16.             indice++;
  17.  
  18.         }
  19.        
  20.         int[] naoDivisiveisOrganizado = new int[indice];
  21.        
  22.         for (int i = 0; i < indice; i++) {
  23.             System.out.print(naoDivisiveisPor5[i] + " ");
  24.             naoDivisiveisOrganizado[i] = naoDivisiveisPor5[i];
  25.         }
  26.        
  27.  
  28.     }
  29. }
  30.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×