fork download
  1. using System; // MASSIV.cs
  2. namespace massiv { public class Program
  3. { static void Main(string[] args)
  4. { int n=10; int[] a = new int[n+1];
  5. Random rand = new Random();
  6. for (int i = 1; i <= n; i++)
  7. { a[i] = rand.Next(200)-100;
  8. Console.Write(a[i]); Console.Write(" ");
  9. }
  10. Console.WriteLine(" ");
  11.  
  12. for (int i = 1; i < n; i++)
  13. for (int j = i+1; j < n+1; j++)
  14. { if (a[i] > a[j])
  15. {var temp = a[j];a[j] = a[i];a[i] = temp;}
  16. }
  17.  
  18. for (int i = 1; i < n+1; i++)
  19. { Console.Write(a[i]); Console.Write(" ");
  20. }}}}
  21.  
Success #stdin #stdout 0.07s 30336KB
stdin
Standard input is empty
stdout
-42 -27 -95 21 64 69 -90 65 40 -86  
-95 -90 -86 -42 -27 21 40 64 65 69