#C14596. Filter Out Divisible Numbers
Filter Out Divisible Numbers
Filter Out Divisible Numbers
Given a list of integers and an integer (X), write a program that returns a new list containing all elements from the original list that are not divisible by (X) (i.e. elements (a) such that (a \bmod X \neq 0)). If (X = 0), the program should output an error message. The program should correctly handle cases where the input list is empty or when no element is divisible by (X).
inputFormat
The input is read from standard input (stdin) and consists of two lines. The first line contains a list of integers separated by spaces (if the list is empty, the line will be empty). The second line contains a single integer (X).
outputFormat
Output the filtered list to standard output (stdout) as a space-separated sequence of integers on one line. If no elements remain after filtering, output an empty line. If (X = 0), output the string "Error".## sample
1 2 3 4 5 6 7 8 9 10
2
1 3 5 7 9