Venciity

[Jumpstart C#] ArraysAndLists - Exmaple

Feb 19th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.74 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ArraysAndLists
  8. {
  9.     class ArraysAndLists
  10.     {
  11.         static void Main()
  12.         {
  13.             var list = new List<int>();    //  List<int> list; по-кратък начин на изписване !
  14.  
  15.             int number;
  16.             do
  17.             {
  18.                 number = Int32.Parse(Console.ReadLine());
  19.                 if (number != 0)
  20.                 {
  21.                    list.Add(number);
  22.                 }
  23.             } while (number != 0);
  24.  
  25.             for (int i = 0; i < list.Count; i++)
  26.             {
  27.                 Console.Write(list[i]+ " ");
  28.             }
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment