Created
October 4, 2017 10:45
For this challenge, you will be given an array and you are * asked to find multiples of 5 and 10 both in the given array, remove them from the array. Rest all the elements will preserve their orders.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class DiscardSpecficContent { | |
public static void main(String[] args) { | |
Scanner sc=new Scanner(System.in); | |
int size; | |
size=sc.nextInt(); | |
int [] arr=new int[size]; | |
for(int i=0;i<size;i++){ | |
arr[i]=sc.nextInt(); | |
} | |
for(int j=0;j<arr.length;j++){ | |
if(arr[j]%5!=0||arr[j]%10!=0){ | |
System.out.print(arr[j]+" "); | |
} | |
} | |
sc.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment