Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ExamPrep
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] array = { 32, 21, 61, 1 };
- int rotations = 4;
- for (int i = 0; i < rotations; i++)
- {
- int temp = array[0];
- for (int j = 0; j < array.Length; j++)
- {
- if (j == array.Length - 1)
- {
- array[j] = temp;
- }
- else
- {
- array[j] = array[j + 1];
- }
- }
- }
- // displaying the array
- for (int i = 0; i < array.Length; i++)
- {
- if (i == array.Length - 1)
- {
- Console.Write(array[i] + "\n");
- }
- else
- {
- Console.Write(array[i] + ", ");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement