Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace WindowsFormsApplication1
- {
- public partial class Form7 : Form
- {
- public Form7()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- //Объявление массивов и переменных для выполнения задания;
- Random rnd = new Random();
- int[] arr = new int[10];
- label1.Text = String.Empty;
- //Начало цикла заполнения массива;
- for (int i = 0; i < 10; i++)
- {
- for (int j = 0; j < 10; j++)
- {
- if (arr[i] == arr[j])
- {
- arr[i] = rnd.Next(10, 50);
- j = 0;
- }
- else j++;
- if (j == arr.Length)
- {
- arr[i] = rnd.Next(10, 50);
- }
- if (i == arr.Length)
- {
- //Вывод массива на форму;
- label1.Text += Convert.ToString(arr[i]) + ",";
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement