Advertisement
Guest User

Untitled

a guest
May 19th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace _2
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         private void Button1_Click(object sender, EventArgs e)
  21.         {
  22.             label2.Text = "";
  23.             label4.Text = "";
  24.  
  25.             int[] mas = new int[20];
  26.             Random r = new Random();
  27.             for (int i = 0; i < 20; i++)
  28.             {
  29.                 mas[i] = r.Next(0, 100);
  30.                 label2.Text = label2.Text + " " + mas[i].ToString();
  31.             }
  32.  
  33.             Array.Sort(mas, (x, y) => x.CompareTo(y));
  34.             for (int i = 0; i < 20; i++)
  35.             {
  36.                 label4.Text = label4.Text + " " + mas[i].ToString();
  37.             }
  38.  
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement