zed_com

Pract_5

Oct 16th, 2016
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.44 KB | None | 0 0
  1. using System;
  2. namespace console
  3. {
  4.     class Program
  5.     {
  6.         static void Main(string[] args)
  7.         {
  8.             Random rd = new Random();
  9.             int k, s1, s2, k1, k2;
  10.             Console.Write("Размер массивов:");
  11.             k = Convert.ToInt32(Console.ReadLine());
  12.             double[] h = new double[k];
  13.             double[] m = new double[k];
  14.             Console.Write("Мин.Рост:");
  15.             s1 = Convert.ToInt32(Console.ReadLine());
  16.             Console.Write("Мaк.Рост:");
  17.             s2 = Convert.ToInt32(Console.ReadLine());
  18.             Console.Write("Мин.Вес:");
  19.             k1 = Convert.ToInt32(Console.ReadLine());
  20.             Console.Write("Мaк.Вес:");
  21.             k2 = Convert.ToInt32(Console.ReadLine());
  22.             for (int i = 0; i < h.Length; i++)
  23.                 h[i] = rd.Next(s1, s2);
  24.             for (int i = 0; i < m.Length; i++)
  25.                 m[i] = rd.Next(k1, k2);
  26.             Console.Write("Массив Рост:");
  27.             foreach (int a in h) Console.Write("{0} ", a);
  28.             Console.Write("\nМассив Вес:");
  29.             foreach (int a in m) Console.Write("{0} ", a);
  30.             Array.Sort(h, m);
  31.             Console.WriteLine();
  32.             foreach (int a in h) Console.Write("{0} ", a);
  33.             Console.WriteLine();
  34.             foreach (int a in m) Console.Write("{0} ", a);
  35.  
  36.             Console.ReadLine();
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment