using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication3 { class Program { static void Main(string[] args) { int[] a , b, c; int n, i, j, k,p, m ; Console.WriteLine("Dati nr de elemente din sir:"); n = Convert.ToInt32(Console.ReadLine()); a = new int[n]; Console.WriteLine("Elementele sirului (introduse cu enter)"); for (i = 0; i < n; i++) a[i] = Convert.ToInt32(Console.ReadLine()); Array.Sort(a); i = m = k = 0; while (i < n) if (a[i++] < 0) k++; else m++; b = new int[k]; c = new int[m]; Console.WriteLine(m); for (i = j=p=0; i < n; i++) { if (a[i] < 0) { b[j] = a[i]; j++; } else { c[p] = a[i]; p++; } } Scrie(a); Scrie(b); Scrie(c); } static void Scrie(int[] v) { foreach (int x in v) Console.Write(x + " "); Console.WriteLine(); } } }