Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace CSharpAdvanced
- {
- class Program
- {
- static void Main(string[] args)
- {
- var numbers = Console.ReadLine()
- .Split()
- .Select(int.Parse)
- .ToList();
- int n = int.Parse(Console.ReadLine());
- var finalNumbers = new List<int>();
- Predicate<int> divisibleBy = x => x % n != 0;
- for (int i = 0; i < numbers.Count; i++)
- {
- if (divisibleBy(numbers[i]))
- {
- finalNumbers.Add(numbers[i]);
- }
- }
- finalNumbers.Reverse();
- Console.WriteLine(string.Join(" ", finalNumbers));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement