Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ExamPrep
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int[] array = { 32, 21, 61, 1 };
  10. int rotations = 4;
  11.  
  12. for (int i = 0; i < rotations; i++)
  13. {
  14. int temp = array[0];
  15. for (int j = 0; j < array.Length; j++)
  16. {
  17. if (j == array.Length - 1)
  18. {
  19. array[j] = temp;
  20. }
  21. else
  22. {
  23. array[j] = array[j + 1];
  24. }
  25. }
  26. }
  27.  
  28. // displaying the array
  29. for (int i = 0; i < array.Length; i++)
  30. {
  31. if (i == array.Length - 1)
  32. {
  33. Console.Write(array[i] + "\n");
  34. }
  35. else
  36. {
  37. Console.Write(array[i] + ", ");
  38. }
  39. }
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement