Advertisement
nyker

Untitled

Apr 4th, 2014
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. using System;
  2. class Program
  3. {
  4. static void Main()
  5. {
  6. int n = int.Parse(Console.ReadLine());
  7. Random rnd = new Random();
  8. int[] arr = new int[n];
  9. for (int counter = 1; counter < arr.Length; counter++)
  10. {
  11. arr[counter] = counter;
  12. }
  13. int temp, index;
  14. for (int i = 0; i < arr.Length; i++)
  15. {
  16. index = rnd.Next(arr.Length);
  17. temp = arr[i];
  18. arr[i] = arr[index];
  19. arr[index] = temp;
  20. }
  21. for (int i = 0; i < arr.Length; i++)
  22. {
  23. Console.Write(arr[i] + 1 + " ");
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement