Bob103

C#_for_Nigga_(IV-7-№8)

Apr 19th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1. class Program
  2.     {
  3.         //GetLength(1)-столбцы
  4.  
  5.         static void Main(string[] args)
  6.         {
  7.             int a = int.Parse(Console.ReadLine());
  8.             int b = int.Parse(Console.ReadLine());
  9.             List<int> numbers = new List<int>();
  10.  
  11.             for (int i=a;i<=b;i++)
  12.             {
  13.                 numbers.Add(int.Parse(Console.ReadLine()));
  14.             }
  15.            
  16.             IEnumerable<int> distinctNumbers = numbers.AsQueryable().Distinct();
  17.  
  18.             Console.WriteLine("Distinct numbers:");
  19.  
  20.             foreach (int num in distinctNumbers)
  21.                 Console.Write(num);
  22.  
  23.             Console.WriteLine();
  24.           }
  25.      }
Advertisement
Add Comment
Please, Sign In to add comment