Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- System.out.println("Size:");
- int size = in.nextInt();
- int [] mass = new int[size];
- int i;
- for ( i=0;i<size;i++)
- {
- System.out.println("Element:");
- mass[i] = in.nextInt();
- }
- System.out.println("Count rol:");
- int rol_count = in.nextInt();
- System.out.println("Before:");
- for (i=0;i<size;i++)
- {
- System.out.print( mass[i]+" ");
- }
- System.out.println("");
- int buf;
- for(int j=0; j<rol_count;j++)
- {
- buf = mass[0];
- for (i=1;i<size;i++)
- {
- mass[i-1]= mass[i];
- }
- mass[size-1]=buf;
- }
- System.out.println("After:");
- for (i=0;i<size;i++)
- {
- System.out.print( mass[i]+" ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement