Advertisement
Guest User

Untitled

a guest
Mar 27th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.23 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.Windows.Forms;
  9.  
  10. namespace WindowsFormsApplication1
  11. {
  12.     public partial class Form7 : Form
  13.     {
  14.         public Form7()
  15.         {
  16.             InitializeComponent();
  17.         }
  18.  
  19.         private void button1_Click(object sender, EventArgs e)
  20.         {
  21.             //Объявление массивов и переменных для выполнения задания;
  22.             Random rnd = new Random(10);
  23.             int[] arr = new int[10];
  24.             label1.Text = String.Empty;
  25.             int x;
  26.             //Начало цикла заполнения массива;
  27.             for (int i = 0; i < 10; i++)
  28.             {
  29.                 arr[i] = rnd.Next(10, 50);
  30.                 x = rnd.Next(10,50);
  31.                 if (arr[i]==x)
  32.                 {
  33.                     x = rnd.Next(10,50);
  34.                     i = 0;
  35.                 }
  36.                 //Вывод массива на форму;
  37.                 label1.Text += Convert.ToString(arr[i]) + ",";
  38.             }
  39.            
  40.  
  41.                
  42.  
  43.             }
  44.         }
  45.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement