Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | None | 0 0
  1. using System;
  2.  
  3. namespace rnd
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int a, b;
  10.             int[] arr;
  11.             Console.Write("Введите первое число ->");
  12.             a = Convert.ToInt32(Console.ReadLine());
  13.             Console.Write("Введите второе число ->");
  14.             b = Convert.ToInt32(Console.ReadLine());
  15.             ArrayFill(a, b, out arr);
  16.             foreach(int i in arr)
  17.             {
  18.                 Console.WriteLine(i);
  19.             }
  20.  
  21.             Console.ReadLine();
  22.         }
  23.  
  24.  
  25.         static void ArrayFill (int a, int b, out int []arr)
  26.         {
  27.             Random rand = new Random();
  28.             arr = new int[10];
  29.             for (int i = 0; i < arr.Length; i++)
  30.                 arr[i] = rand.Next(a, arr.Length);
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement