Advertisement
Batisk_AFF

tail-6

Oct 16th, 2020
189
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 ConsoleApp1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int[] arr = new int[10];
  14.             Random rnd = new Random();
  15.  
  16.             for (int i = 0; i < 10; ++i) arr[i] = rnd.Next(0, 10);
  17.  
  18.             Console.Write("Unsorted array: ");
  19.             for (int i = 0; i < 10; ++i) Console.Write(arr[i].ToString() + " ");
  20.             Console.WriteLine();
  21.  
  22.             Array.Sort(arr);
  23.  
  24.             Console.Write("Sorted array: ");
  25.             for (int i = 0; i < 10; ++i) Console.Write(arr[i].ToString() + " ");
  26.             Console.WriteLine();
  27.  
  28.         }
  29.     }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement