Advertisement
Guest User

problem 11

a guest
Apr 2nd, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. using System;
  2.  
  3. class RandomNumbersinGivenRange
  4. {
  5.     static void Main()
  6.     {
  7.         int n = int.Parse(Console.ReadLine());
  8.         int min = int.Parse(Console.ReadLine());
  9.         int max = int.Parse(Console.ReadLine());
  10.         Random rnd = new Random();
  11.         for (int i = 1; i <= n; i++)
  12.         {
  13.             int random = rnd.Next(max) + min;
  14.             if (random < min || random > max)
  15.             {
  16.                 i--;
  17.                 continue;
  18.             }            
  19.             Console.Write("{0} ", random);
  20.         }        
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement