Guest User

Untitled

a guest
Jan 22nd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.  
  13.             Random rnd = new Random();
  14.  
  15.             int[] tomb = new int[5];
  16.  
  17.             int i = 0;
  18.  
  19.             while(i < 5)
  20.             {
  21.  
  22.                 int szam = rnd.Next(10, 16);
  23.                 Boolean bennevan = false;
  24.  
  25.                 foreach (int elem in tomb)
  26.                 {
  27.                     if (elem == szam)
  28.                     {
  29.                         bennevan = true;
  30.                     }
  31.                 }
  32.  
  33.                 if (bennevan != true)
  34.                 {
  35.                     tomb[i] = szam;
  36.                     Console.WriteLine(szam);
  37.                     i++;
  38.                 }
  39.                
  40.             }
  41.  
  42.             Console.ReadKey();
  43.         }
  44.     }
  45. }
Add Comment
Please, Sign In to add comment