Advertisement
dim4o

Loops_11_RandomNumbersInGivenRange

Mar 26th, 2014
731
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.59 KB | None | 0 0
  1.  static void Main()
  2.         {
  3.             int count = int.Parse(Console.ReadLine());
  4.             int minInt = int.Parse(Console.ReadLine());
  5.             int maxInt = int.Parse(Console.ReadLine());
  6.             if (minInt <= maxInt)
  7.             {
  8.                 Random random = new Random();
  9.                 for (int index = 0; index < count; index++)
  10.                 {
  11.                     Console.Write("{0} ", random.Next(minInt, maxInt + 1));
  12.                 }
  13.             }
  14.             else
  15.             {
  16.                 Console.WriteLine("incorrect input");
  17.             }    
  18.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement