Advertisement
Guest User

Random Numbers in Given Range

a guest
Dec 9th, 2014
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. using System;
  2. class RandomNumsInGivenRange
  3. {
  4. static void Main()
  5. {
  6. int n = int.Parse(Console.ReadLine());
  7. int min = int.Parse(Console.ReadLine());
  8. int max = int.Parse(Console.ReadLine());
  9. if (min < max)
  10. {
  11. for (int i = 0; i < n; i++)
  12. {
  13. Random rndNum = new Random();
  14. int randomNums = rndNum.Next(min, max);
  15. Console.Write(randomNums + " ");
  16. }
  17. }
  18. else
  19. {
  20. Console.WriteLine();
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement