0

I have a code that create an array and then fills it with consecutive integers starting with 1:

    Scanner in = new Scanner(System.in);
    int NumOfValues = in.nextInt();
    int[] array = new int[NumOfValues];
    for (int i = 0; i < array.length; i++) {
        array[i] = i + 1;

    }

I now want to remove all numbers that are multiples of n (ex.: 5) from the array. I've tried using an if statement with a .slice() but I don't know what to enter int the brackets.

   if (array[i] % 5 == 0){
   array.slice()
   }

Thanks in advance!

Dan
  • 175
  • 1
  • 1
  • 7

0 Answers0